• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to pass request objects from one page to another

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone has a idea about my question?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Patience is a virtue
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic