List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:com.esd.cs.statistics.ReportController.java
/** * ?//from w w w . jav a 2 s. c om * * @param request * @return */ @RequestMapping(value = "/nature", method = RequestMethod.GET) public ModelAndView nature(HttpServletRequest request, HttpSession session) { String nowYear = (String) session.getAttribute(Constants.YEAR); request.setAttribute("year", nowYear); request.setAttribute("currentTime", CommonUtil.formatData()); request.setAttribute("createTabCompany", createTabCompany);// ? request.setAttribute("createPeople", session.getAttribute(Constants.USER_REAL_NAME).toString());// return new ModelAndView("report/nature"); }
From source file:com.esd.cs.statistics.ReportController.java
/** * ? /*from w w w .ja v a 2s . co m*/ * * @param request * @return */ @RequestMapping(value = "/economytype", method = RequestMethod.GET) public ModelAndView economytype(HttpServletRequest request, HttpSession session) { String nowYear = (String) session.getAttribute(Constants.YEAR); request.setAttribute("year", nowYear); request.setAttribute("currentTime", CommonUtil.formatData()); request.setAttribute("createTabCompany", createTabCompany);// ? request.setAttribute("createPeople", session.getAttribute(Constants.USER_REAL_NAME).toString());// return new ModelAndView("report/economytype"); }
From source file:com.learningobjects.community.abgm.servlet.ConfigServlet.java
private void sendReceipt(HttpServletRequest request, HttpServletResponse response, String message, boolean success, Exception e) throws ServletException, IOException { // redirect to error receipt page request.setAttribute("message", message); request.setAttribute("receipt_type", success ? "SUCCESS" : "FAIL"); request.setAttribute("exception", e); getServletContext().getRequestDispatcher("/receipt.jsp").forward(request, response); }
From source file:com.redhat.rhn.frontend.action.LoginSetupAction.java
/** {@inheritDoc} */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {//from ww w . j a v a2 s . c o m CertificateManager man = CertificateManager.getInstance(); if (man.isSatelliteCertExpired()) { addMessage(request, "satellite.expired"); request.setAttribute(HAS_EXPIRED, new Boolean(true)); return mapping.findForward("default"); } else if (man.isSatelliteCertInGracePeriod()) { long daysUntilExpiration = man.getDaysLeftBeforeCertExpiration(); createSuccessMessage(request, "satellite.graceperiod", String.valueOf(daysUntilExpiration)); } else if (!UserManager.satelliteHasUsers()) { return mapping.findForward("needuser"); } if (AclManager.hasAcl("user_authenticated()", request, null)) { return mapping.findForward("loggedin"); } // ok handle the case where we're doing the ReLogin page String urlBounce = (String) request.getAttribute("url_bounce"); if (!StringUtils.isEmpty(urlBounce)) { if (log.isDebugEnabled()) { log.debug("request.getAttribute(url_bounce): " + urlBounce); } DynaActionForm f = (DynaActionForm) form; f.set("url_bounce", urlBounce); } return mapping.findForward("default"); }
From source file:com.esd.cs.statistics.ReportController.java
/** * // w w w .j ava 2 s . co m * * @param request * @return */ @RequestMapping(value = "/area", method = RequestMethod.GET) public ModelAndView area(HttpServletRequest request, HttpSession session) { String nowYear = (String) session.getAttribute(Constants.YEAR); request.setAttribute("year", nowYear); request.setAttribute("currentTime", CommonUtil.formatData()); request.setAttribute("createTabCompany", createTabCompany);// ? request.setAttribute("createPeople", session.getAttribute(Constants.USER_REAL_NAME).toString());// return new ModelAndView("report/area"); }
From source file:edu.caltechUcla.sselCassel.projects.jMarkets.frontdesk.web.actions.EditSessionConfigAction.java
/** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). * Return an <code>ActionForward</code> instance describing where and how * control should be forwarded, or <code>null</code> if the response has * already been completed./*from w ww .j a v a2 s . c o m*/ * * @param mapping The ActionMapping used to select this instance * @param actionForm The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception Exception if the application business logic throws * an exception */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Extract attributes we will need HttpSession session = request.getSession(); if ("request".equals(mapping.getScope())) { request.setAttribute(mapping.getAttribute(), form); } else { session.setAttribute(mapping.getAttribute(), form); } DynaValidatorForm expForm = (DynaValidatorForm) form; if (!isExperimenter(session)) return (mapping.findForward("login_fail")); else return (mapping.findForward("success")); }
From source file:eionet.cr.web.action.TabularDataServlet.java
/** * * @param exception//from ww w . j a v a 2 s . c o m * @param request * @param response * @throws ServletException * @throws IOException */ private void handleException(Exception exception, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { LOGGER.error(exception); if (Util.isWebBrowser(request)) { request.setAttribute(StripesExceptionHandler.EXCEPTION_ATTR, exception); request.getRequestDispatcher(StripesExceptionHandler.ERROR_PAGE).forward(request, response); } else { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.ShowCourseSiteAction.java
public ActionForward showExecutionCourseSite(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { String degreeId = getFromRequest("degreeID", request); request.setAttribute("degreeID", degreeId); String executionCourseId = getFromRequest("executionCourseID", request); request.setAttribute("executionCourseID", executionCourseId); ISiteComponent firstPageComponent = new InfoSiteFirstPage(); ISiteComponent commonComponent = new InfoSiteCommon(); Object[] args = { commonComponent, firstPageComponent, null, executionCourseId, null, null }; ExecutionCourseSiteView siteView = null; try {/*from w ww. j a v a 2 s .co m*/ siteView = ExecutionCourseSiteComponentService.runExecutionCourseSiteComponentService(commonComponent, firstPageComponent, null, executionCourseId, null, null); request.setAttribute("objectCode", ((InfoSiteFirstPage) siteView.getComponent()).getSiteExternalId()); request.setAttribute("siteView", siteView); request.setAttribute("executionCourseCode", ((InfoSiteCommon) siteView.getCommonComponent()).getExecutionCourse().getExternalId()); request.setAttribute("executionPeriodCode", ((InfoSiteCommon) siteView.getCommonComponent()) .getExecutionCourse().getInfoExecutionPeriod().getExternalId()); if (siteView.getComponent() instanceof InfoSiteSection) { request.setAttribute("infoSection", ((InfoSiteSection) siteView.getComponent()).getSection()); } } catch (NonExistingServiceException e) { throw new NonExistingActionException("A disciplina", e); } catch (FenixServiceException e) { throw new FenixActionException(e); } return mapping.findForward("showExecutionCourseSite"); }
From source file:dijalmasilva.controllers.ControladorUser.java
@RequestMapping("/disable/{id}") public String cancelUser(@PathVariable Long id, HttpServletRequest req) throws IOException { serviceUser.desativarConta(id);/*from w w w .j a v a2 s . c o m*/ req.getSession().invalidate(); req.setAttribute("result", "Sua conta foi desativada."); return "redirect:/home"; }