File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes problem when the jsp get refreshed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem when the jsp get refreshed" Watch "problem when the jsp get refreshed" New topic
Author

problem when the jsp get refreshed

Prasanna RamKumar
Ranch Hand

Joined: Nov 30, 2005
Posts: 31
i have developed jsp where i have text fields and combo box

once i select the region in the combo box it will call a action class where it get the values based on selected region in combo box



using a javascripot and return back to the same screen

and the results are displayed in the same screenn in the location combo box

it works 5n but when the screen is refreshed again what ever the values that iam entering in the text box and other field get disappeared

what should i do in this case
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 512
Hi,
You need to read and store the request parameters in the request attributes when control comes to your action class for fetching data.
While rendering the JSP you need to check for values in request attributes and populate them. If there are no values then it will be empty(which is the case when you visit the page first time.)
Thanks,
amit


Regards,
Amit
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
This simple case is one where an Ajax solution works very well. Since you would only be refreshing the one list on the page you would not have to worry about the other fields because they would not change.

With a non-Ajax solution you need to submit the page. In your action you need to detect that the page was submitted because a list needed to be populated (and not because the user wanted to save the data). On my project there is some common code to handle this that then forwards to the action specified in the input attribute of the mapping..

- Brent
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem when the jsp get refreshed