i have a form (registration.jsp) which is associated with a form bean. The bean is in session scope. I need it in the session for various reasons which i wont go into right now. Now everything happens fine and when i submit the page all goes fine.
However, when i come back into the page like suppose on submit i have to go back into home page and have a link to get back into registration.jsp then the form bean that comes into memory is the exact same one as the previous one.
How do i know this, i printed out all the objects in request scope. When i did this i found out that the form bean alone referred to the exact same address irrespective of the round trips that i made to the server.
As a result of this problem, my jsp pages retains all the values and basically i have a refresh problem. Is there a way i can remove the form bean on sucess of the page without putting any more holes into my code
org.apache.struts.taglib.html.BEAN::::request:::::::::com.zerodegrees.struts.for ms.auth.RegisterFormBean@3f6843 is what my request parameter prints out when the request for the page is made the first time.
on confirmation of the page i go into the home page again and come back into the registration page and see what it prints again
See u can call the reset method of that form bean explicitly and in that method can reset the values when necessary ...but one thing is that if u reset it then the values wont be available further .........so the bset idea is to keep the required values in session attributes rather than part of the form bean r dont use this formbean for other pages as the data will be persisted and it will display u unnecessary data
I had a similar problem and the reset method was not appropriate (can't tell you why right now -- I don't have my books and notes with me), but my solution was to code a utility class which I called ClearForms in which I explicitly set each of the form's elements to "" (empty string). I call the appropriate method (ie, ClearForms.clearApplicantForm) just prior to displaying the form. It works great. If you want more info on why reset didn't work for me, I will be glad to post another reply after reviewing my notes at work tomorrow. Good luck.