wood burning stoves 2.0*
The moose likes JSP and the fly likes How to transfer object from servlet tp JSP and back to Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to transfer object from servlet tp JSP and back to Servlet" Watch "How to transfer object from servlet tp JSP and back to Servlet" New topic
Author

How to transfer object from servlet tp JSP and back to Servlet

mvPrasad Regula
Ranch Hand

Joined: Sep 14, 2009
Posts: 42
I have an issue:
I jave two jsp's jspone and jsptwo and two servlets Servone and Servtwo.
Steps I am supposed to do:
1. Enter data in jspone
2. Click on Submit to ServletOne(using <Form> tag)
3. Collect the values in servlet one and set the values to ValueObjectOne.
4. Set CaluObjectOne to request object.
5. Using RequestDispatcher(request.getRequestDispatcher()) forward to jsptwo.
6. Declare <%@Usebean ...%> in jsptwo
7. Enter the values in jsptwo and submit the form
8. Use ServletTwo and collect ValueObjectOne and ValueObjectTwo(Generated from jsptwo) --> //Here I am failing. I am getting both the
//valueObjects as null


Prasad Regula
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

Unless the object is in the HttpSession, it is gone once the request is done. This would we when the JSP finishes rendering. If you don't want to use the session, you can pass the fields in the object via a forum and create a new object.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
mvPrasad Regula
Ranch Hand

Joined: Sep 14, 2009
Posts: 42
I tried session earlier. If I type session, I am getting error there.
I will paste my code below could you please make the changes. I will be thankful to you.
1. jspone


2. JSPTwo


3. ServletOne



4. ServletTwo
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to transfer object from servlet tp JSP and back to Servlet