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:com.teamexception.reseravationmaven.controller.VehicleTypeServiceController.java

@RequestMapping(value = "add", method = RequestMethod.POST)
public String addVehicleType(HttpServletRequest request) throws ClassNotFoundException, SQLException {
    settingUpValues(request);/*from  w w  w  . ja v a 2  s  .  c om*/
    if (serviceTypeDAO.addServiceVehilceType(type)) {
        String msg = "Type added sucessfully";
        request.setAttribute("msg", msg);
    } else {
        String msg = "Failed To add";
        request.setAttribute("msg", msg);
    }
    return "success";
}

From source file:org.lareferencia.xoai.services.impl.context.LRContextService.java

@Override
public Context getContext() throws ContextServiceException {
    HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
            .getRequest();/*  w ww  .ja va 2s.c  om*/
    Object value = request.getAttribute(OAI_CONTEXT);
    if (value == null || !(value instanceof Context)) {
        try {
            request.setAttribute(OAI_CONTEXT, new Context());
        } catch (SQLException e) {
            throw new ContextServiceException(e);
        }
    }
    return (Context) request.getAttribute(OAI_CONTEXT);
}

From source file:org.shredzone.flufftron.view.PersonView.java

/**
 * Shows an individual person.//from   w  w w. ja  v  a2 s  . c o m
 */
@View(pattern = "/for/${person.nick}.html", signature = { "person" })
public String personView(@PathPart("person.nick") Person person, HttpServletRequest req)
        throws ViewException, TwitterException {
    List<Fluff> fluffs = fluffDao.findByPerson(person, 0, MAX_PERSON_FLUFFS);
    Map<ObjectId, Person> persons = fluffService.getPersonMap(fluffs);

    req.setAttribute("person", person);
    req.setAttribute("persons", persons);
    req.setAttribute("fluffs", fluffs);
    req.setAttribute("pageName", "person");
    return "view/person.jsp";
}

From source file:com.ibm.bluemix.samples.HomeServlet.java

/**
 * Returns information about the files stored in the database to the home.jsp
 *//*w w  w . ja v a  2 s  .c  o m*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    System.out.println("Home Servlet");

    try {
        List<JSONObject> files = db.getResults();
        request.setAttribute("files", files);
    } catch (Exception e) {
        request.setAttribute("msg", e.getMessage());
        request.setAttribute("files", new ArrayList<JSONObject>());
        e.printStackTrace(System.err);
    }

    response.setContentType("text/html");
    response.setStatus(200);
    request.getRequestDispatcher("/home.jsp").forward(request, response);
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.administrativeOffice.studentEnrolment.StudentExternalEnrolmentsDA.java

public ActionForward chooseExternalUnit(ActionMapping mapping, ActionForm actionForm,
        HttpServletRequest request, HttpServletResponse response) {

    request.setAttribute("registration", getRegistration(request, actionForm));
    request.setAttribute("unit", UnitUtils.readEarthUnit());
    return mapping.findForward("chooseExternalUnit");
}

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

public ActionForward prepareTransit(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {/*from  ww  w. java 2  s  . c  o  m*/
    request.setAttribute("studentCurricularPlan", getStudentCurricularPlan(request));
    return mapping.findForward("transitToBolonha");
}

From source file:com.me.controller.SalesOrderController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    String action = request.getParameter("action");
    ModelAndView model = new ModelAndView();
    if (action.equals("display")) {
        request.setAttribute("display", action);
        model.setViewName("salesOrderPage");

    } else if (action.equals("upload")) {
        String fileName = request.getParameter("FileName");
        request.setAttribute("FileName", fileName);
        request.setAttribute("upload", action);
        /*/*from  w ww.  j  a va 2s.  c o  m*/
        List<SalesOrder> salesOrderList = csvUploadDAO.getSalesOrderDetail();
                
        request.setAttribute("list", salesOrderList);
        model.addObject("list", salesOrderList);
            */
        model.setViewName("salesOrderPage");
    } else if (action.equals("insertDatabase")) {
        // String fc = request.getParameter("FileName");
        List<SalesOrder> salesOrder = csvUploadDAO.getSalesOrderDetail();
        int result = csvUploadDAO.result(salesOrder);
        request.setAttribute("insertDatabase", action);
        model.addObject("result", result);
        model.setViewName("salesOrderPage");
    }

    return model;
}

From source file:br.org.indt.ndg.servlets.OpenRosaManagement.java

private void dispatchExportResultsForUserPage(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String[] userList = m_openRosaBD.getUserList();
    request.setAttribute(USER_IMEI_LIST_ATTR, userList);
    request.setAttribute(EXPORT_RESULTS_FOR_USER, "export");
    request.getRequestDispatcher(FORWARD_FILEPATH).forward(request, response);
}

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

public ActionForward setParameter(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {/*from w w w  .j a  v  a 2  s.c om*/
    EmailConfig emailConfig = getEmailConfig();
    request.setAttribute("config", emailConfig);
    request.setAttribute("tabtype", "parameter");
    request.setAttribute("act", request.getParameter("act"));
    return mapping.getInputForward();
}

From source file:controller.EmployeeController.java

@RequestMapping(value = "/employeemanager", method = RequestMethod.GET)
public String employeeManager(HttpServletRequest request) {
    HttpSession session = request.getSession();
    User user = new GeneralUser();
    if (user.checkSession(session)) {
        if (user.getActor(session, "admin")) {
            request.setAttribute("manv", new Employee().autoMNV());
            request.setAttribute("chucvu", new Employee().getPosition());
            request.setAttribute("mnv", new Employee().getMNV());
            return "quanlynhanvien";
        } else {/*from   w  ww  . j a v  a 2 s  .c om*/
            request.setAttribute("message", "Bn khng c quy?n truy cp vo mc va ri!");
            user.logout(request.getSession());
            return "dangnhap";
        }
    } else {
        request.setAttribute("message", "Vui lng ng nhp!");
        return "dangnhap";
    }

}