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

Retaining jsp form data when accessing a separate menu item  RSS feed

 
Melodie Rice
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to retain all the jsp form values when a user exits the jsp and accesses another jsp from a menu item, then returns back to the original jsp.

So:
1. User enters form information in jsp
2. User chooses menu item during visit or entering the jsp. (The menu item references another jsp which is a "how to" page)
3. User return to original page via a javascript.history() command.
4. Original info on original form is empty.

Thanks!

I usually go through a servlet when processing jsp info but not in this case.

Thanks so much!

Mel...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
history usually moves back an forth through the browser's cache offering little opportunity for exerting control over what happens. It's not a good way to perform navigation in a web app.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following the MVC design pattern shows that you should always point the browser to a servlet, and the servlet should display information to the user by forwarding to a JSP page. Although this is not a complete explanation of the design pattern, using this you would have a servlet which sets up JavaBeans (or some data objects) and assign them to the session (or other scope as you see fit). The JSP page would then just display the information stored in this session object.

This would work very well for what you are trying to do, as the JSP page wouldn't care if this was the first time it was displayed, or if it was being displayed after the user took a trip through the help pages.

I see you say that normally, you use servlets, but not in this case. I would say you should be using servlets so perhaps you need to revisit that decision.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!