Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Putting values back into forms from a database via servlets  RSS feed

 
John Pugh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm having problems putting values back into a form which have been previously entered in on the same form and gone into a database, so that the user can edit them.
I've tried adding headers to the response but it doesn't seem to work, any ideas ? is it possible, I'm trying to avoid redrawing the form in a servlet as it is rather large.
Thanks
John
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you put the values in a javabean and put the bean in the session?
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't want to generate the page in the servlet, and are not or cannot use JSP, you can pass the form values in the URL and use JavaScript on the page to parse the URL command string and place the passed values into the form elements.
 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Instead of storing the details in the session object it is better to pass the values as a request object , as considering the fact the you are handling large data's and storing the details in the session will take more time.
Regards,
M.S.Raman
 
Nagendra Prasad
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raman,
Any chance that you could post some code snippet to do this bit of work?
Thanks.
 
Phil Chuang
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So Malli, you're saying that for one-page use objects, it's best to put them in the request and forward to the page, rather than put it in the session and do either a redirect/forward?
What are the costs/benefits of using the request over the session?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!