• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

problem when the jsp get refreshed

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic