Java Code Examples for org.apache.struts2.ServletActionContext#getRequest()
The following examples show how to use
org.apache.struts2.ServletActionContext#getRequest() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NoCacheInterceptor.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public String intercept( ActionInvocation invocation ) throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); String header = response.getHeader( ContextUtils.HEADER_CACHE_CONTROL ); boolean headerSet = header != null && !header.trim().isEmpty(); if ( !headerSet && HttpMethod.GET == HttpMethod.resolve( request.getMethod() ) ) { ContextUtils.setNoStore( response ); } return invocation.invoke(); }
Example 2
Source File: ElectiveAction.java From Course-System-Back with MIT License | 6 votes |
public String addElective() { request = ServletActionContext.getRequest(); String username = request.getParameter("username"); String teachId = request.getParameter("teachId"); boolean flag = true; if (username != null && teachId != null) { flag = electiveService.addElective(Integer.valueOf(username), Integer.valueOf(teachId)); } if (flag) { addStatus = "SUCCESS"; } else { addStatus = "ERROR"; } return SUCCESS; }
Example 3
Source File: TeacherAction.java From Course-System-Back with MIT License | 6 votes |
public String addTeacher() { request = ServletActionContext.getRequest(); String teaName = request.getParameter("teaName"); String sex = request.getParameter("sex"); String teaId = request.getParameter("teaId"); teacher = new Teacher(); teacher.setTeaName(teaName); teacher.setSex(sex); teacher.setTeaId(Integer.valueOf(teaId)); String departmendId = request.getParameter("departmentId"); boolean flag = teacherService.addNewTeacher(teacher, Integer.valueOf(departmendId)); if (flag) { addStatus = "SUCCESS"; } else { addStatus = "ERROR"; } return SUCCESS; }
Example 4
Source File: AgreementAction.java From OA with GNU General Public License v3.0 | 6 votes |
public String deleteAgree() { System.out.println("agreeId is "+agreeId); Agreement agree = agreementService.selectAgree(Agreement.class,agreeId); agreementService.deleteAgree(agree); String hql = ""; List<Agreement> agreements = agreementService.getAgreementPages((index==0 ? 1 : index), Agreement.class, hql); int total = agreementService.getAllAgreements(Agreement.class, hql).size(); HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listAgree", agreements); request.setAttribute("currentIndex", (index==0 ? 1 : index )); request.setAttribute("totalSize",total); return "operator_success"; }
Example 5
Source File: PayPlanAction.java From OA with GNU General Public License v3.0 | 6 votes |
public String PayPlanList() { String hql = ""; List<PayPlan> PayPlans = PayPlanService.getPagePayPlans((index == 0 ? 1 : index), PayPlan.class, hql); for (PayPlan m : PayPlans) { System.out.println(m.toString()); } HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listObject", PayPlans); request.setAttribute("currentIndex", (index == 0 ? 1 : index)); int total = PayPlanService.getAllPayPlans(PayPlan.class, hql).size(); // request.setAttribute("pid",(PayPlan==null ? "": PayPlan.getId())); request.setAttribute("totalSize", total); request.setAttribute("url", "PayPlanAction!PayPlanList?"); getSelect(); return "PayPlanList"; }
Example 6
Source File: SalesAgreementAction.java From OA with GNU General Public License v3.0 | 6 votes |
public String SalesAgreementList() { String hql=""; List<SalesAgreement> SalesAgreements = salesAgreementService.getpageAgreements((index == 0 ? 1 : index), SalesAgreement.class, hql); for (SalesAgreement m : SalesAgreements) { System.out.println(m.toString()); } HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listObject", SalesAgreements); request.setAttribute("currentIndex", (index == 0 ? 1 : index)); int total = salesAgreementService.getAllsalesAgreements(SalesAgreement.class, hql).size(); // request.setAttribute("pid",(SalesAgreement==null ? "": SalesAgreement.getId())); request.setAttribute("totalSize", total); request.setAttribute("url", "SalesAgreementAction!SalesAgreementList?"); return "SalesAgreementList"; }
Example 7
Source File: SupplierManagerAction.java From OA with GNU General Public License v3.0 | 6 votes |
public String SupplierManagerList() { String hql=""; List<SupplierManager> SupplierManagers = SupplierManagerService.getPageSupplierManagers((index == 0 ? 1 : index), SupplierManager.class, hql); for (SupplierManager m : SupplierManagers) { System.out.println(m.toString()); } HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listObject", SupplierManagers); request.setAttribute("currentIndex", (index == 0 ? 1 : index)); int total = SupplierManagerService.getAllSupplierManagers(SupplierManager.class, hql).size(); // request.setAttribute("pid",(SupplierManager==null ? "": SupplierManager.getId())); request.setAttribute("totalSize", total); request.setAttribute("url", "SupplierManagerAction!SupplierManagerList?"); return "SupplierManagerList"; }
Example 8
Source File: WorkFlowAction.java From OA with GNU General Public License v3.0 | 5 votes |
public String listWorkFlow() { String hql = ""; List<WorkFlow> workFlows = workFlowService.getPageWorkFlows( (index == 0 ? 1 : index), hql); HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listObject", workFlows); request.setAttribute("currentIndex", (index == 0 ? 1 : index)); int total = workFlowService.getAllWorkFlows(hql).size(); request.setAttribute("totalSize", total); request.setAttribute("url", "WorkFlowAction!listWorkFlow?"); return "listWorkFlow"; }
Example 9
Source File: TeachAction.java From Course-System-Back with MIT License | 5 votes |
public String deleteTeach() { request = ServletActionContext.getRequest(); String teachId = request.getParameter("teachId"); boolean flag = false; flag = teachService.deleteTeach(Integer.valueOf(teachId)); if (flag) { delStatus = "SUCCESS"; } else { delStatus = "ERROR"; } return SUCCESS; }
Example 10
Source File: BpmTypeFormAction.java From entando-components with GNU Lesser General Public License v3.0 | 5 votes |
protected Widget extractCurrentWidget() { try { HttpServletRequest request = (null != this.getRequest()) ? this.getRequest() : ServletActionContext.getRequest(); RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX); if (null != reqCtx) { return (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET); } } catch (Throwable t) { throw new RuntimeException("Error extracting currentWidget ", t); } return null; }
Example 11
Source File: ElectiveAction.java From Course-System-Back with MIT License | 5 votes |
public String deleteElective() { request = ServletActionContext.getRequest(); String eleId = request.getParameter("electiveId"); boolean flag = true; if (eleId != null) { flag = electiveService.deleteElective(Integer.valueOf(eleId)); } if (flag) { delStatus = "SUCCESS"; } else { delStatus = "ERROR"; } return SUCCESS; }
Example 12
Source File: FieldItemAction.java From OA with GNU General Public License v3.0 | 5 votes |
public String deleteFieldItem(){ HttpServletRequest request=ServletActionContext.getRequest(); String []ids=request.getParameterValues("delid"); for (int i = 0; i < ids.length; i++) { System.out.println(ids[i]); } fieldItemService.DeleteListFieldItems(ids); returns="FieldItemAction!ListItems"; return "operator_success"; }
Example 13
Source File: AttendanceManagementAction.java From OA with GNU General Public License v3.0 | 5 votes |
public String OnAndOffRegister() { List<OnAndOffRegister> listOnAndOffRegisters = attendanceService.getRegisterSet(); HttpServletRequest request = ServletActionContext.getRequest(); HttpSession session = request.getSession(); request.setAttribute("onTime", listOnAndOffRegisters.get(0).getRegularTime()); request.setAttribute("offTime", listOnAndOffRegisters.get(1).getRegularTime()); Users user = (Users)session.getAttribute("admin"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String date = sdf.format(new Date()); System.out.println("date is "+date); List<UserOnAndOffRegister> userOnAndOffRegisterList = attendanceService.select(user.getId(),date); System.out.println("userONandoff list size is "+userOnAndOffRegisterList.size()); if(userOnAndOffRegisterList.size() != 0) { if(userOnAndOffRegisterList.get(0).getOnTime() == null && userOnAndOffRegisterList.get(0).getOffTime() != null) { request.setAttribute("hasClickedOff", "hasClicked"); return "OnAndOffRegister"; } if(userOnAndOffRegisterList.get(0).getOnTime() != null && userOnAndOffRegisterList.get(0).getOffTime() == null) { request.setAttribute("hasClickedOn", "hasClicked"); return "OnAndOffRegister"; } if(userOnAndOffRegisterList.get(0).getOnTime() != null && userOnAndOffRegisterList.get(0).getOffTime() != null) { request.setAttribute("hasClickedOff", "hasClicked"); request.setAttribute("hasClickedOn", "hasClicked"); return "OnAndOffRegister"; } } return "OnAndOffRegister"; }
Example 14
Source File: ModuleAction.java From OA with GNU General Public License v3.0 | 5 votes |
public String deletemodule(){ System.out.println("deleteperson"); returns="ModuleAction!moduleList"; HttpServletRequest request=ServletActionContext.getRequest(); String []ids=request.getParameterValues("delid"); System.out.println(ids.length+"sdfsadf"); for (int i = 0; i < ids.length; i++) { System.out.println(ids[i]); } moduleService.deleteModules(ids); returns="ModuleAction!moduleList"; return "operator_success"; }
Example 15
Source File: PerformanceParametersAction.java From OA with GNU General Public License v3.0 | 5 votes |
public String find(){ String hql = ""; List<PerformanceParameters> performanceParameters = performanceParametersService.getPerformanceParametersPages((index==0 ? 1 : index), PerformanceParameters.class, hql); int total = performanceParametersService.getAllPerformanceParameterss(PerformanceParameters.class, hql).size(); HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listPerformanceParameters", performanceParameters); request.setAttribute("currentIndex", (index==0 ? 1 : index )); request.setAttribute("totalSize",total); return "selectPerformanceParameters"; }
Example 16
Source File: PerformanceExamineAction.java From OA with GNU General Public License v3.0 | 5 votes |
public String getAddData() { List<PerformanceParameters> listParameters = performanceExamineService.getAllParams(); List<Person> listPersons = performanceExamineService.getAllPerson(peId); HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listPersons", listPersons); request.setAttribute("itemCount", listParameters.size()*listPersons.size()); request.setAttribute("listParameters", listParameters); return "addPerformanceExamine"; }
Example 17
Source File: OrganizationAction.java From OA with GNU General Public License v3.0 | 5 votes |
public String delete() { System.out.println("delete organization"); HttpServletRequest request=ServletActionContext.getRequest(); String []ids=request.getParameterValues("delid"); System.out.println(ids.length+"sdfsadf"); for (int i = 0; i < ids.length; i++) { System.out.println(ids[i]); organization = organizationService.select(Organization.class, Integer.valueOf(ids[i])); organizationService.delete(organization); } return "operator_success"; }
Example 18
Source File: Struts2Utils.java From DWSurvey with GNU Affero General Public License v3.0 | 4 votes |
/** * 取得HttpRequest的简化函数. */ public static HttpServletRequest getRequest() { return ServletActionContext.getRequest(); }
Example 19
Source File: BaseAction.java From Mall-Server with MIT License | 4 votes |
protected String getParam(String paramName) { HttpServletRequest req = ServletActionContext.getRequest(); String paramValue = req.getParameter(paramName); return paramValue; }
Example 20
Source File: TeacherAction.java From Course-System-Back with MIT License | 4 votes |
public String findTeacherById() { request = ServletActionContext.getRequest(); String teaId = request.getParameter("teaId"); teacher = teacherService.selectTeacherById(Integer.valueOf(teaId)); return SUCCESS; }