Example usage for javax.servlet.http HttpServletRequest setAttribute

List of usage examples for javax.servlet.http HttpServletRequest setAttribute

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest setAttribute.

Prototype

public void setAttribute(String name, Object o);

Source Link

Document

Stores an attribute in this request.

Usage

From source file:io.github.benas.todolist.web.servlet.user.LoginServlet.java

private void addGlobalLoginErrorAttribute(HttpServletRequest request) {
    request.setAttribute("error", resourceBundle.getString("login.error.global"));
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.manager.personManagement.FindPersonAction.java

public ActionForward viewPerson(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {//from ww w.j  a v a  2s  . c  om
    request.setAttribute("person", getDomainObject(request, "personID"));
    return mapping.findForward("viewPerson");
}

From source file:BookListXMLJSPServlet.java

protected void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    List bookList = BookListFactory.INSTANCE;

    request.setAttribute("bookList", bookList);
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/booklist1.jsp");
    dispatcher.include(request, response);
}

From source file:common.cms.controller.SimpleCmsDelegate.java

/**
 * must show items associated with this table
 * @param req//  ww  w  .j  a  va  2 s.co m
 * @param resp
 * @return
 */
@Override
public ModelAndView doView(HttpServletRequest req, HttpServletResponse resp) {
    //logger.fine("do=view");
    getCommonModel(req);
    req.setAttribute(config.getContentUrlAttribute(), config.getContentViewTemplate());
    req.setAttribute(config.getContentDataAttribute(), service.getAllShortCms());
    return new ModelAndView(config.getTemplateUrl());
}

From source file:grails.plugin.freemarker.GrailsFreeMarkerView.java

@Override
protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request) throws Exception {
    //for Grails 2 we need to set this so sitemesh works
    request.setAttribute("org.grails.rendering.view", true);
    model.put("flash", WebUtils.retrieveGrailsWebRequest().getAttributes().getFlashScope(request));
    super.exposeHelpers(model, request);
}

From source file:com.tsg.sitemapwebappmvc.controller.FactorizorController.java

@RequestMapping(value = "/FactorizorController", method = RequestMethod.POST)
public String getFactorResults(HttpServletRequest request, Model model) {

    Factors factorize = new Factors(Integer.parseInt(request.getParameter("numberToFactor")));
    request.setAttribute("factors", factorize.getFactors());
    request.setAttribute("perfect", factorize.isPerfect());
    request.setAttribute("prime", factorize.isPrime());

    return "factresponse";
}

From source file:com.feilong.controller.TestController.java

@RequestMapping("/helloworld1")
public String test1(HttpServletRequest request, HttpSession session, HttpServletResponse response) {

    session.setAttribute("name", "?");
    request.setAttribute("name", "");
    session.getServletContext().setAttribute("name", "?");

    return UrlBasedViewResolver.REDIRECT_URL_PREFIX + "/index";
}

From source file:pl.edu.icm.comac.vis.server.TimingInterceptor.java

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) throws Exception {
    request.setAttribute(HANDLING_END_ATTR, System.currentTimeMillis());
}

From source file:com.xdtech.message.controller.NewController.java

@RequestMapping(params = "editNew")
public ModelAndView editNew(HttpServletRequest request, Long id) {
    if (id != null) {
        request.setAttribute("newItem", newService.loadNewItem(id));
    }/*from   www. j  a v a  2 s .  c om*/
    return new ModelAndView("message/new/editNew_ftl");
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.manager.ViewPersonsWithRoleDA.java

public ActionForward searchWithRole(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    request.setAttribute("role", getDomainObject(request, "roleID"));
    return mapping.findForward("ShowPersons");
}