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:net.sourceforge.fenixedu.presentationTier.Action.personnelSection.ManagePeople.java

@EntryPoint
public ActionForward prepareCreatePerson(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    final AnyPersonSearchBean anyPersonSearchBean = new AnyPersonSearchBean();
    request.setAttribute("anyPersonSearchBean", anyPersonSearchBean);
    return mapping.findForward("createPerson");
}

From source file:com.epam.cme.storefront.interceptors.beforecontroller.BeforeControllerInterceptor.java

@Override
public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response,
        final Object handler) throws Exception {
    if (request.getAttribute(INTERCEPTOR_ONCE_KEY) == null) {
        // Set the flag so that we are not executed multiple times
        request.setAttribute(INTERCEPTOR_ONCE_KEY, Boolean.TRUE);

        // Call the pre handler once for the request
        for (final BeforeControllerHandler beforeControllerHandler : getBeforeControllerHandlers()) {
            if (!beforeControllerHandler.beforeController(request, response)) {
                // Return false immediately if a handler returns false
                return false;
            }// w w  w . jav a  2s  .co  m
        }
    }

    return true;
}

From source file:io.muic.ooc.webapp.servlet.UserServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String username = request.getParameter("username");

    User user = userService.getUser(username);

    if (user != null) {
        request.setAttribute("user", username);

        StringBuilder userDetails = new StringBuilder("<table class=\"table table-bordered table-striped\">"
                + "<thead class=\"thead-inverse\"><tr><th>UserInfo</th><th></th></thead>");
        userDetails.append("<tr><td>Username</td><td>" + user.getUserName() + "</td></tr>");
        //            userDetails.append("<tr><td>Password</td><td>"+user.getPassword()+"</td></tr>");
        userDetails.append("<tr><td>Email</td><td>" + user.getEmail() + "</td></tr>");
        userDetails.append("<tr><td>FirstName</td><td>" + user.getFirstName() + "</td></tr>");
        userDetails.append("<tr><td>LastName</td><td>" + user.getLastName() + "</td></tr>");
        userDetails.append("</tbody></table>");
        request.setAttribute("userDetails", userDetails);

        RequestDispatcher rd = request.getRequestDispatcher("WEB-INF/user.jsp");
        rd.include(request, response);/*from w w w  .  j a v  a2  s  .  c om*/
    } else {
        response.sendRedirect("/");
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.masterDegree.administrativeOffice.candidate.CreateCandidateDispatchAction.java

public ActionForward chooseExecutionYear(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    request.setAttribute(PresentationConstants.EXECUTION_YEAR, request.getParameter("executionYear"));
    String curricularPlanID = request.getParameter("degreeCurricularPlanID");

    if (curricularPlanID == null) {
        curricularPlanID = (String) request.getAttribute("curricularPlanID");

    }//w  ww .j  a va2s  . c o  m
    request.setAttribute("degreeCurricularPlanID", curricularPlanID);

    request.setAttribute(PresentationConstants.EXECUTION_DEGREE, request.getParameter("executionDegreeID"));
    return mapping.findForward("CreateReady");

}

From source file:com.devnexus.ting.web.interceptor.GlobalDataInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object object)
        throws Exception {

    final List<Event> events = businessService.getAllNonCurrentEvents();
    final Event currentEvent = businessService.getCurrentEvent();
    request.setAttribute("eventsForMenu", events);
    request.setAttribute("currentEvent", currentEvent);
    request.setAttribute("contextEvent", currentEvent);

    final String cfpState = environment.getProperty("cfpState.state");
    request.setAttribute("cfpState", cfpState);

    final String registrationState = environment.getProperty("registration.state");
    request.setAttribute("registrationState", registrationState);

    return true;/*w w w .j a  va  2  s  .  c  o  m*/
}

From source file:org.shredzone.cilla.view.HeaderView.java

/**
 * Shows a map of the location the header picture was taken at.
 *//*w w w  . jav a  2  s. c  o m*/
@Framed
@View(pattern = "/header/${header.id}/map/${#simplify(header.name)}.html", name = "header.map")
public String headerMapView(@PathPart("header.id") Header header, HttpServletRequest req) throws ViewException {
    if (!headerService.isVisible(header)) {
        throw new ErrorResponseException(HttpServletResponse.SC_FORBIDDEN);
    }

    req.setAttribute("headerImage", header);

    return "view/headerMap.jsp";
}

From source file:com.nominanuda.web.http.ServletHelper.java

public void storeCommand(HttpServletRequest servletRequest, DataStruct command) throws IOException {
    servletRequest.setAttribute("__command__", command);
}

From source file:com.redhat.rhn.frontend.action.audit.scap.XccdfSearchAction.java

@Override
protected void insureFormDefaults(HttpServletRequest request, DynaActionForm form) {
    String searchString = form.getString(SEARCH_STR);
    String whereToSearch = form.getString(WHERE_TO_SEARCH);

    request.setAttribute(SEARCH_STR, searchString);
    form.set(WHERE_TO_SEARCH, "system_list".equals(whereToSearch) ? whereToSearch : "all");
    setupRuleResultLabelOptions(request);
    setupShowAsOption(form);/*from  w  w  w.j av  a 2 s  . co m*/
    Map m = form.getMap();
    Set<String> keys = m.keySet();
    for (String key : keys) {
        Object vObj = m.get(key);
        request.setAttribute(key, vObj);
    }
}

From source file:edu.duke.cabig.c3pr.web.ViewParticipantController.java

@Override
protected Map referenceData(HttpServletRequest request, int page) throws Exception {
    request.setAttribute("flowType", "VIEW_SUBJECT");
    return super.referenceData(request, page);
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.ShowClassesDispatchAction.java

private void organizeClassViewsNext(final HttpServletRequest request, final Degree degree,
        final ExecutionSemester executionSemester, final ExecutionSemester otherExecutionPeriodToShow) {
    request.setAttribute("classViewsTableCurrent", organizeClassViews(degree, executionSemester));
    request.setAttribute("classViewsTableNext", organizeClassViews(degree, otherExecutionPeriodToShow));
}