List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:com.esd.cs.settings.YearAuditParameterController.java
/** * ?//from ww w . java2 s. c o m * * @param request * @return */ @RequestMapping(value = "/add", method = RequestMethod.GET) public ModelAndView addGet(HttpServletRequest request) { String year = CalendarUtil.getBeforeYear(); request.setAttribute("year", year); return new ModelAndView("settings/parameter_save"); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.administrativeOffice.studentEnrolment.StudentExternalEnrolmentsDA.java
public ActionForward createExternalEnrolmentsInvalid(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { request.setAttribute("externalCurricularCourseEnrolmentBeans", getRenderedObject()); request.setAttribute("registration", getRegistration(request, actionForm)); request.setAttribute("externalUnit", getExternalUnit(request, actionForm)); return mapping.findForward("createExternalEnrolments"); }
From source file:com.parallax.server.blocklyprop.servlets.PasswordResetServlet.java
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String token = req.getParameter("token"); String email = req.getParameter("email"); req.setAttribute("token", token == null ? "" : token); req.setAttribute("email", email == null ? "" : email); String password = req.getParameter("password"); String confirmPassword = req.getParameter("confirmpassword"); if (Strings.isNullOrEmpty(token) || Strings.isNullOrEmpty(email) || Strings.isNullOrEmpty(password) || Strings.isNullOrEmpty(confirmPassword)) { req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp); } else {//from www. ja v a 2 s . c o m try { if (cloudSessionLocalUserService.doPasswordReset(token, email, password, confirmPassword)) { showTextilePage(req, resp, PasswordResetPage.RESET_DONE); //req.getRequestDispatcher("WEB-INF/servlet/password-reset/reset-done.jsp").forward(req, resp); } else { req.setAttribute("invalidToken", "Invalid token"); req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp); } } catch (UnknownUserException ex) { req.setAttribute("invalidToken", "Unknown email"); req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp); } catch (PasswordVerifyException ex) { req.setAttribute("passwordsDontMatch", "Passwords do not match"); req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp); } catch (ServerException se) { req.setAttribute("server-error", "Server exception"); req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp); } catch (PasswordComplexityException pce) { req.setAttribute("passwordComplexity", "Password is not complex enough"); req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp); } catch (WrongAuthenticationSourceException ex) { log.warn("Trying to change password of non local user!"); req.setAttribute("server-error", "Server exception"); req.getRequestDispatcher("WEB-INF/servlet/password-reset/do-reset.jsp").forward(req, resp); } } }
From source file:net.sourceforge.fenixedu.presentationTier.Action.administrativeOffice.candidacy.DFAPeriodsManagementDispatchAction.java
@EntryPoint public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {//from w w w. j a v a 2 s. co m ((DynaActionForm) form).set("executionYear", ExecutionYear.readCurrentExecutionYear().getExternalId().toString()); request.setAttribute("executionYears", ExecutionYear.readNotClosedExecutionYears()); return mapping.findForward("chooseExecutionYear"); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.messaging.FindPersonAction.java
@EntryPoint public ActionForward prepareFindPerson(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { FindPersonBean bean = new FindPersonBean(); request.setAttribute("bean", bean); return mapping.findForward("findPerson"); }
From source file:cn.edu.zjnu.acm.judge.config.JudgeHandlerInterceptor.java
@ModelAttribute public void addAttributes(HttpServletRequest request, @RequestParam(value = "url", required = false) String url, Authentication authentication) { if (Boolean.TRUE.equals(request.getAttribute(APPLIED_ONCE_KEY))) { return;/*from w w w. ja v a2s .com*/ } request.setAttribute(APPLIED_ONCE_KEY, true); if (!StringUtils.isEmptyOrWhitespace(url)) { request.setAttribute(BACK_URL_ATTRIBUTE_NAME, url); } else { String uri = getString(RequestDispatcher.FORWARD_SERVLET_PATH, HttpServletRequest::getServletPath, request); String query = getString(RequestDispatcher.FORWARD_QUERY_STRING, HttpServletRequest::getQueryString, request); if (query != null) { uri = uri + '?' + query; } request.setAttribute(BACK_URL_ATTRIBUTE_NAME, uri); } Optional.ofNullable(authentication).map(Authentication::getName).map(mailMapper::getMailInfo) .ifPresent(mailInfo -> request.setAttribute("mailInfo", mailInfo)); }
From source file:io.github.benas.todolist.web.servlet.user.RegisterServlet.java
private void checkPasswordsMatch(HttpServletRequest request, String password, String confirmationPassword) { if (!confirmationPassword.equals(password)) { request.setAttribute("errorConfirmationPasswordMatching", resourceBundle.getString("register.error.password.confirmation.error")); addGlobalRegistrationErrorAttribute(request); }//w w w .j a v a2 s.co m }
From source file:de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.checkout.steps.AbstractCheckoutStepController.java
@ExceptionHandler(UnknownIdentifierException.class) public String handleUnknownIdentifierException(final UnknownIdentifierException exception, final HttpServletRequest request) { LOGGER.error(exception.getMessage()); request.setAttribute("message", exception.getMessage()); return FORWARD_PREFIX + "/404"; }
From source file:com.base.service.AdminService.java
public List<Admin> getList(HttpServletRequest request) { Order order = new Order(); order.put("createTime", Order.DESC); QueryResult<Admin> res = this.adminDao.query(request, order, null); request.setAttribute("count", res.getCount()); return res.getResults(); }
From source file:com.stratelia.silverpeas.pdcPeas.servlets.PdcSearchRequestRouterHelper.java
/** * Set attributes into the request in order to prepare data to be displayed. <br> Attributes are * build by information which are inside the sessionController * * @param pdcSC the pdcSessionController * @param request HTTP servlet request//from w w w. j a v a 2 s .c om * @param setSpacesAndComponents if false do nothing, else if add SpaceList and ComponentList * attributes into the request * @throws Exception */ public static void setAttributesAdvancedSearch(PdcSearchSessionController pdcSC, HttpServletRequest request, boolean setSpacesAndComponents) throws Exception { String selectedSpace = null; String selectedComponent = null; QueryParameters queryParameters = pdcSC.getQueryParameters(); if (queryParameters != null) { selectedSpace = queryParameters.getSpaceId(); selectedComponent = queryParameters.getInstanceId(); } SilverTrace.info("pdcPeas", "PdcPeasRequestRouterHelper.setAttributesAdvancedSearch()", "root.MSG_GEN_PARAM_VALUE", "selectedSpace = " + selectedSpace); SilverTrace.info("pdcPeas", "PdcPeasRequestRouterHelper.setAttributesAdvancedSearch()", "root.MSG_GEN_PARAM_VALUE", "selectedComponent = " + selectedComponent); if (setSpacesAndComponents) { request.setAttribute("SpaceList", pdcSC.getAllowedSpaces()); if (selectedSpace != null) { request.setAttribute("ComponentList", pdcSC.getAllowedComponents(selectedSpace)); } } if (!pdcSC.isSelectionActivated()) { pdcSC.buildComponentListWhereToSearch(selectedSpace, selectedComponent); } // The selection is active ? request.setAttribute("ActiveSelection", Boolean.valueOf(pdcSC.isSelectionActivated())); }