• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

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

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 40286
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
mvPrasad Regula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'm not sure if I approve of this interruption. But this tiny ad checks out:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic