List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:org.jmesaweb.controller.GroovyPresidentController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mv = new ModelAndView(successView); Collection<President> items = presidentService.getPresidents(); String html = htmlTableTemplate.build(items, request); request.setAttribute("presidents", html); // Set the Html in the request for the JSP. return mv;//www . ja v a 2s. c o m }
From source file:com.redhat.rhn.frontend.taglibs.list.helper.ListHelper.java
/** * *//*from w w w.j av a 2s .co m*/ private void setupDataSet() { List dataSet = listable.getResult(context); HttpServletRequest request = context.getRequest(); request.setAttribute(ListTagHelper.PARENT_URL, getParentUrl()); request.setAttribute(getDataSetName(), dataSet); if (!StringUtils.isBlank(getListName()) && dataSet instanceof DataResult) { DataResult data = (DataResult) dataSet; Elaborator elab = data.getElaborator(); if (elab != null) { TagHelper.bindElaboratorTo(getListName(), elab, request); } } }
From source file:com.glaf.base.modules.todo.springmvc.TodoController.java
/** * TODO/*from ww w . j a v a 2 s .c o m*/ * * @return */ @RequestMapping(params = "method=userTasks") public ModelAndView userTasks(ModelMap modelMap, HttpServletRequest request) { logger.debug("-----------------userTasks----------------------------"); RequestUtils.setRequestParameterToAttribute(request); List<Todo> rows = todoService.getAllTodoList(); request.setAttribute("rows", rows); TodoListBean bean = new TodoListBean(); List<TodoTotal> userTasks = bean.getUserTasks(RequestUtils.getActorId(request), RequestUtils.getParameterMap(request)); request.setAttribute("userTasks", userTasks); return new ModelAndView("/modules/sys/todo/userTasks", modelMap); }
From source file:edu.caltechUcla.sselCassel.projects.jMarkets.frontdesk.web.actions.SaveJoinExpAction.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 ww w . j a v a2 s. co 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 regForm = (DynaValidatorForm) form; return (mapping.findForward("success")); }
From source file:Controllers.AddItem.java
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request//from w w w . ja va2s .c o m * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ArrayList<Category> categories = ItemRepository.getCategories(); request.setAttribute("categories", categories); request.getRequestDispatcher("dashboard/addItem.jsp").forward(request, response); }
From source file:eionet.cr.web.action.TabularDataServlet.java
/** * * @param message//from w ww . j a va 2s .c o m * @param request * @param response * @throws ServletException * @throws IOException */ private void handleFileNotFound(String message, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { LOGGER.info(message); if (Util.isWebBrowser(request)) { request.setAttribute(StripesExceptionHandler.EXCEPTION_ATTR, new CRException(message)); request.getRequestDispatcher(StripesExceptionHandler.ERROR_PAGE).forward(request, response); } else { response.sendError(HttpServletResponse.SC_NOT_FOUND); } }
From source file:com.healthcit.cacure.web.controller.LoginController.java
@RequestMapping(method = RequestMethod.POST) public String onSubmit(UserCredentials userCredentials, BindingResult result, HttpServletRequest req, HttpServletResponse resp) {/* ww w . ja v a 2 s . co m*/ Validator validator = new UserCredentialsValidator(); validator.validate(userCredentials, result); if (result.hasErrors()) { req.setAttribute(ATTR_VALIDATION_ERR, Boolean.TRUE); return "login"; } StringBuilder jSecurityRedirect = new StringBuilder("j_security_check"); jSecurityRedirect.append("?userName=").append(userCredentials.getUserName()); jSecurityRedirect.append("&password=").append(userCredentials.getPassword()); try { resp.sendRedirect(jSecurityRedirect.toString()); } catch (IOException e) { log.error("could not redirect to j_security_check"); } return "login"; }
From source file:edu.cornell.mannlib.vitro.webapp.controller.jena.JenaCsv2RdfController.java
private void forwardToFileUploadError(String errrorMsg, HttpServletRequest req, HttpServletResponse response) throws ServletException { VitroRequest vreq = new VitroRequest(req); req.setAttribute("title", "CSV to RDF Error "); req.setAttribute("bodyJsp", "/jsp/fileUploadError.jsp"); req.setAttribute("errors", errrorMsg); RequestDispatcher rd = req.getRequestDispatcher(Controllers.BASIC_JSP); req.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + vreq.getAppBean().getThemeDir() + "css/edit.css\"/>"); try {//from w w w.ja v a 2 s. co m rd.forward(req, response); } catch (IOException e1) { log.error(e1); throw new ServletException(e1); } return; }
From source file:net.groupbuy.interceptor.ExecuteTimeInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Long startTime = (Long) request.getAttribute(START_TIME_ATTRIBUTE_NAME); if (startTime == null) { startTime = System.currentTimeMillis(); request.setAttribute(START_TIME_ATTRIBUTE_NAME, startTime); }/*from ww w.ja v a 2 s . c om*/ return true; }
From source file:org.lamsfoundation.lams.admin.web.ToolContentListAction.java
private boolean checkPriviledge(HttpServletRequest request) { if (!getUserManagementService().isUserSysAdmin()) { request.setAttribute(ToolContentListAction.ATTRIBUTE_ERROR_NAME, "ToolContentListAction"); request.setAttribute(ToolContentListAction.ATTRIBUTE_ERROR_MESSAGE, AdminServiceProxy.getMessageService(getServlet().getServletContext()) .getMessage("error.no.sysadmin.priviledge")); return false; }// w ww. j a v a 2 s .c om return true; }