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:edu.cornell.mannlib.vitro.webapp.controller.SparqlQueryBuilderServlet.java

private void doHelp(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    req.setAttribute("title", "SPARQL Query Builder");
    req.setAttribute("bodyJsp", "/admin/sparql.jsp");

    RequestDispatcher rd = req.getRequestDispatcher("/" + Controllers.BASIC_JSP);
    rd.forward(req, res);/* ww w .  java 2 s .c  o m*/
}

From source file:com.adnature.framework.web.util.Struts2Utils.java

/**
 * ??Request//from   www.  ja  v a2  s . co  m
 * @param prefix ??
 */
public static void fillSearchParams(String prefix) {
    if (StringUtils.isBlank(prefix)) {
        return;
    }
    HttpServletRequest request = getRequest();
    Map<String, Object> parmMap = new HashMap<String, Object>();
    // request??????,?????Map
    Map<String, Object> filterParamMap = WebUtils.getParametersStartingWith(request, prefix + "#filter_");
    if (filterParamMap != null && !filterParamMap.isEmpty()) {
        for (Entry<String, Object> entry : filterParamMap.entrySet()) {
            String filterName = entry.getKey();
            String value = ((String) entry.getValue()).trim().replaceAll("\"", "&quot;");
            value = value.replaceAll("<", "&lt;");
            value = value.replaceAll(">", "&gt;");
            // value,filter.
            boolean omit = StringUtils.isBlank(value);
            if (!omit) {
                request.setAttribute("filter_" + filterName, value);
                parmMap.put("filter_" + filterName, value);

            }
        }
        //         request.setAttribute(HibernateWebUtils.SEARCH_KEY, parmMap);
        request.setAttribute(prefix, parmMap);
    }
}

From source file:org.parancoe.web.LanguageInterceptor.java

@Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse res, Object object) throws Exception {
    RequestContext rc = new RequestContext(req);
    req.setAttribute("requestContext", rc);
    req.setAttribute("lang", rc.getLocale().getLanguage());
    logger.debug("LanguageInterceptor.preHandle()");
    return true;//w  ww. jav a 2  s  . co m
}

From source file:cn.vlabs.umt.ui.actions.ActivationSecondaryAction.java

/**
 * ??/*from w  w  w.  j a v a2 s.c om*/
 * */
public ActionForward doLoginSecondary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    request.setAttribute("token", form);
    request.setAttribute("_primaryEmail", request.getParameter("primaryEmail"));
    return mapping.findForward("set.secondaryEmail.show.login");
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.library.ManageCapacityAndLockersDA.java

@EntryPoint
public ActionForward prepareUpdateCapacityAndLockers(ActionMapping mapping, ActionForm actionForm,
        HttpServletRequest request, HttpServletResponse response) {
    request.setAttribute("libraryInformation", new LibraryInformation());
    return mapping.findForward("libraryUpdateCapacityAndLockers");
}

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

public ActionForward prepareEditLoginTimeInterval(ActionMapping mapping, ActionForm actionForm,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    request.setAttribute("period", getDomainObject(request, "periodID"));
    return mapping.findForward("prepareEditLoginTimeInterval");
}

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

public ActionForward prepareCreateLoginTimeInterval(ActionMapping mapping, ActionForm actionForm,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    request.setAttribute("user", getDomainObject(request, "userID"));
    return mapping.findForward("prepareCreateNewLoginTimeInterval");
}

From source file:cn.vlabs.umt.ui.actions.UserSafeAction.java

/**
 * /* ww  w  . ja v a 2 s.co m*/
 * */
public ActionForward showLog(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {
    int uid = SessionUtils.getUserId(request);
    request.setAttribute("loginMessage",
            getAccountService().getTopTenLogByEventType(uid, UMTLog.EVENT_TYPE_LOG_IN));
    request.setAttribute("changeSecurityEmailMessage",
            getAccountService().getTopTenLogByEventType(uid, UMTLog.EVENT_TYPE_CHANGE_SECURITY_EMAIL));
    request.setAttribute("changePasswordMessage",
            getAccountService().getTopTenLogByEventType(uid, UMTLog.EVENT_TYPE_CHANGE_PASSWORD));
    return mapping.findForward("safe.log.show");
}

From source file:dijalmasilva.controllers.ControladorGrupo.java

@RequestMapping("/findByName")
public String getGroups(String nome, HttpServletRequest req) {
    List<Grupo> groups = serviceGrupo.buscarPorNome(nome);
    req.setAttribute("gruposEncontrados", groups);
    return "groupsfind";
}

From source file:org.jutge.joc.porra.controller.mobile.MobileAccountController.java

@ExceptionHandler(LoginException.class)
public String signupExceptionHandler(final LoginException exception, final HttpServletRequest request) {
    this.logger.info("MobileAccountController.signupExceptionHandler");
    request.setAttribute("usr", exception.getAccountName());
    request.setAttribute("errors", EntityStashUtils.toJsonString(exception.getErrorMessages()));
    return "/mobile/account/login";
}