• Post Reply Bookmark Topic Watch Topic
  • New Topic

Redisplay info when a user goes back to previous page  RSS feed

 
darren schild
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble redisplaying the information the user entered on a previous screen.
I have a "prev" and "next" bottom.
If the user wants to correct some information on the "prev" screen. Upon their return, the information is gone and they have to re-enter the information?!?
If I do a <jsp:getProperty> I get an null object exception.
Any help/suggestions/sample code?
Thanks much!
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to save the request from the current page in e.g. a HashMap in e.g. Session. Then run the Map through when you 'reenter' the page and parse the values to the fields.
/Rene
 
darren schild
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, I'm a newbie so that is part of the problem.
I am using a session, whether I'm setting it up right is another question.
The exception comes on the first time thru when I make a call to the Bean and I get the exception:
org.apache.jasper.JasperException: Attempted a bean operation on a null object.
On the call to:
<jsp:getProperty name="customer" property="firstName" />
This probably isn't enough information but any ideas???
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a question - do you only use JSP or are you in for Servlet as well?
/Rene
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've made a sample:
first.jsp

second.jsp, next.jsp....

HelperBean.java

Just to give you an idea.
/Rene
[ July 17, 2002: Message edited by: Rene Larsen ]
 
darren schild
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help!
I am using a servlet, JSPs & a bean.... Haven't worked, much, with hashmaps but i'm getting there.....
So, I have 3 JSPs a contact.jsp, a contactInfo.jsp and a contactDisplay.jsp, along with the Contact(servlet) and ContactCustomer(bean). When I fill out the contact page the request is then forwarded to the contactInfo.jsp when I hit "prev" to go back and edit, everything is gone.
It's gotta be something simple but.........
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, as I can read from your post, the sample I just gave you will fulfil what you need
/Rene
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!