• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem when the jsp get refreshed

 
Prasanna RamKumar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic