List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:io.github.benas.todolist.web.servlet.todo.CreateTodoServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("today", new SimpleDateFormat(TodoListUtils.DATE_FORMAT).format(new Date())); request.getRequestDispatcher(CREATE_TODO_PAGE).forward(request, response); }
From source file:org.jutge.joc.porra.controller.desktop.DesktopAccountController.java
@ExceptionHandler(LoginException.class) public String signupExceptionHandler(final LoginException exception, final HttpServletRequest request) { this.logger.info("DesktopAccountController.signupExceptionHandler"); request.setAttribute("usr", exception.getAccountName()); request.setAttribute("errors", EntityStashUtils.toJsonString(exception.getErrorMessages())); return "desktop/account/login"; }
From source file:net.sourceforge.fenixedu.presentationTier.Action.teacher.ListVigilanciesForEvaluationDispatchAction.java
private ActionForward doForward(HttpServletRequest request, String path) { request.setAttribute("teacher$actual$page", path); return new ActionForward("/evaluation/evaluationFrame.jsp"); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.manager.LoginsManagementDA.java
@EntryPoint public ActionForward prepareSearchPerson(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { request.setAttribute("personBean", new PersonBean()); return mapping.findForward("prepareSearchPerson"); }
From source file:com.wisemapping.filter.RequestPropertiesInterceptor.java
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, Object object) throws Exception { request.setAttribute("google.analytics.enabled", analyticsEnabled); request.setAttribute("google.analytics.account", analyticsAccount); request.setAttribute("google.ads.enabled", adsEnabled); request.setAttribute("site.homepage", siteHomepage); request.setAttribute("security.type", securityType); request.setAttribute("security.openid.enabled", openIdEnabled); // If the property could not be resolved, try to infer one from the request... if ("${site.baseurl}".equals(siteUrl)) { siteUrl = request.getRequestURL().toString().replace(request.getRequestURI(), request.getContextPath()); }//ww w .j ava 2s. c o m request.setAttribute("site.baseurl", siteUrl); return true; }
From source file:com.wx.spring.controller.CustomerController.java
@RequestMapping("/getCustomer") public String getAllCustomers(HttpServletRequest request, Customer customer) { System.out.println("Enter:Run at Controller: CustomerController:getAllCustomers"); request.setAttribute("userList", customerService.getAllCustomer()); request.setAttribute("saleList", saleService.getAllSalesRecordsByCustomer("Shi.Yi.Ting")); request.setAttribute("bmList", bmService.getAllBMByCustomerId(customer.getId())); request.setAttribute("regClass", 79); System.out.println("Outer:Run at Controller: CustomerController:getAllCustomers"); return "Customer/userInfo"; }
From source file:com.ofbizcn.securityext.login.LoginEvents.java
/** Show the password hint for the userLoginId specified in the request object. *@param request The HTTPRequest object for the current request *@param response The HTTPResponse object for the current request *@return String specifying the exit status of this event *//* ww w. j a v a2 s . c o m*/ public static String showPasswordHint(HttpServletRequest request, HttpServletResponse response) { Delegator delegator = (Delegator) request.getAttribute("delegator"); String userLoginId = request.getParameter("USERNAME"); String errMsg = null; if ((userLoginId != null) && ("true".equals( EntityUtilProperties.getPropertyValue("security.properties", "username.lowercase", delegator)))) { userLoginId = userLoginId.toLowerCase(); } if (!UtilValidate.isNotEmpty(userLoginId)) { // the password was incomplete errMsg = UtilProperties.getMessage(resource, "loginevents.username_was_empty_reenter", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } GenericValue supposedUserLogin = null; try { supposedUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId) .queryOne(); } catch (GenericEntityException gee) { Debug.logWarning(gee, "", module); } if (supposedUserLogin == null) { // the Username was not found errMsg = UtilProperties.getMessage(resource, "loginevents.username_not_found_reenter", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } String passwordHint = supposedUserLogin.getString("passwordHint"); if (!UtilValidate.isNotEmpty(passwordHint)) { // the Username was not found errMsg = UtilProperties.getMessage(resource, "loginevents.no_password_hint_specified_try_password_emailed", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } Map<String, String> messageMap = UtilMisc.toMap("passwordHint", passwordHint); errMsg = UtilProperties.getMessage(resource, "loginevents.password_hint_is", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", errMsg); return "success"; }
From source file:net.sourceforge.fenixedu.presentationTier.Action.alumni.AlumniSearchDA.java
public ActionForward visualizeAlumni(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { request.setAttribute("alumniData", getDomainObject(request, "studentId")); return mapping.findForward("viewAlumniDetails"); }
From source file:common.cms.controller.LocalizedCmsDelegate.java
/** * must show items associated with this table * @param req/*from w w w. ja va 2 s. c om*/ * @param resp * @return */ @Override public ModelAndView doView(HttpServletRequest request, HttpServletResponse resp) { //logger.fine("do=view"); getCommonModel(request); request.setAttribute(config.getContentUrlAttribute(), config.getContentViewTemplate()); LocaleDataCms data = new LocaleDataCms(); List<T> cur = service.getCurrentLocalization(RequestContextUtils.getLocale(request).getLanguage()); data.setCurrent(cur); data.setOther(service.getOtherLocalization(RequestContextUtils.getLocale(request).getLanguage(), cur)); request.setAttribute(config.getContentDataAttribute(), data); return new ModelAndView(config.getTemplateUrl()); }
From source file:common.web.controller.StatisticController.java
@Override public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { request.setAttribute(conf.getContentUrlAttribute(), content_url); request.setAttribute(conf.getNavigationUrlAttribute(), navigation_url); request.setAttribute("title", "?"); request.setAttribute("top_header", "?"); createModel(request);// w ww. j a va 2 s. c o m return new ModelAndView(conf.getTemplateUrl()); }