aspose file tools*
The moose likes Struts and the fly likes New page is loading with old values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "New page is loading with old values" Watch "New page is loading with old values" New topic
Author

New page is loading with old values

Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
My application contains 4 forms, for the first time I created application by running four JSPs successfully, after that I tried to create another application, while creating I see a strange thing the when after I submitted forst page, it supposed to go second page with blank fields, but here the old values are showing in the fields.
what could be the issue here and how to clean the form fields when new page enters?


Thanks,
Kumar
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Is the form bean for your transaction session scoped? You may need to add code to the reset method of your form to clear out the values between requests.
Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
Yes Tom, they are session,

even though I have already reset method which is making nulls to form fields
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Can you tell if your application server is being called when the page opens with the data on it, or if IE is pulling the page from its cache?
Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
When the previous page's data is stored in DB, then Im forwarding to current JSP. I think it could be the cache problem,

but if I use request scope in the action configuration, then the page is loading without data.
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Is the form bean that you have specified for the action the same form bean that is used by the JSP. You may need to call reset on the form used by the JSP before the JSP is executed.
Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
but Im using reset method in the form bean, is there any other way to call this reset method before jsp loads?
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
You can call that reset method from the action class if you like. If you call reset on the form before just before your action class ends and the fields that you've reset still have values, then I would assume that the problem is that your browser is caching the page.
Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
Can we call reset method explicitly in our corresponding action class?
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Yep, I don't see anything that would stop you. Infact I think I've done this before.
Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
Hi Tom,

I have tried by calling reset method after DB calling done, yes I got no previous data in the fields.

Thanks for this idea.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New page is loading with old values