This discussion is archived
4 Replies Latest reply: May 29, 2012 1:12 AM by gimbal2 RSS

How to carry an object from one JSP to another JSP?

srhcan Newbie
Currently Being Moderated
How can I carry an object from one JSP to another JSP?

I have a servlet where I am setting an object in request as an attribute and then forwarding to PageA.jsp.
MyDTO myDTO = new MyDTO();
request.setAttribute("MyDTO", myDTO);
RequestDispatcher rd = getServletContext().getRequestDispatcher("/PageA.jsp");
rd.forward(request, response);

I can get MyDTO object in PageA.jsp:
MyDTO myDTO = (MyDTO) request.getAttribute("MyDTO");

Now PageA.jsp has a form named form_pageA which submits to PageB.jsp. How can I make sure that myDTO object is available in PageB.jsp? I would like to not store it in session.

Edited by: srhcan on May 4, 2012 7:52 PM


  • Correct Answers - 10 points
  • Helpful Answers - 5 points