I have one JSP page in which I have one combo box containing search criteria and one text box containing the search value. When search is performed by clicking some button , the control passes to action which again comes back to the same JSP page. I want the search criteria that I had chosen to be shown as the first one in the combo, but it shows diff one. Within action i have tried to set the value on the form such that form.setXXXXX(search criteria ) but it does not seem to work.
Make sure your jsp's select tags are the struts version.
What you described should work. Post some code if you're still having probs.
In fact, you should not even need to do setXXX from the Action because struts will reuse the same ActionForm; this is true even if ActionForm is in request scope because your submission/redisplay occurs in a single request.
A good workman is known by his tools.
Ajai
Ranch Hand
Joined: May 29, 2002
Posts: 198
posted
0
Hi, Thanks for reply. Below is the code snippet. html:select property="selectedValue" value="Select to search" name="getAllInstancesForm" html ption value="Installation Key" html ption value="Instance Key" html ption value="Host Name" html ption value="Service Name" html ption value="Version" html ption value="Status" html:select
Originally posted by Buggi Sandhu: The problem is I select the option as status or anything else,then when I come back I always get Installation Key.
What is the scope of the action? If it's request, it may not find the updated formbean. Please test the code by putting the scope to be session, so as to retain the formbean and let us know.
Another approach could be to persist the data and retrive again.