Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to pass request objects from one page to another

 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my Registration.java servlet page I am



I have forwarded control through requestDispatcher to jsp


Then In my register.jsp page


On selecting some value from one of my select box I am posting the data to another servlet named DoctorData.java


But I am unable to get the values of the attributes in this page
When I tried to use those values I get a NullPointerException
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65337
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I am unable to get the values of the attributes in this page


That's correct. Those attributes went out of scope when the request in which they were created returned its response to the browser.

If you want them to persist across requests, you'll need to either pass them along as hidden parameters in the page, or store them in the session (be sure to explicitly remove them when no longer needed).
[ December 08, 2005: Message edited by: Bear Bibeault ]
 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want them to persist across requests, you'll need to either pass them along as hidden parameters in the page, or store them in the session (be sure to explicitly remove them when no longer needed).


That's correct. Tell me in detail. How to store data of ArrayList in a hidden variable and get it back inside a scriptlet.
 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone has a idea about my question?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65337
97
IntelliJ IDE Java jQuery Mac Mac OS X
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot use Form's to send Objects. Only Strings can be send across with Html Forms.

Use Session scope as suggested by Bear.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic