This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Combo box  RSS feed

 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


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.

Any help would be appreciated.

Thanks
 
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ajai
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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



html:text property="searchValue" size="40" name=getAllInstancesForm
html:button property="button" value="Search" onblick=searchInstanceFunction()


The problem is I select the option as status or anything else,then when
I come back I always get Installation Key.

Thanks... .
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

Thanks and Regards,
Kinjal Sonpal
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I think the problem is the value attribute of the select element.

Create an html ption with value="Select to search" and you'll see what I mean.

To correct the problem, remove the value attribute from the select element.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!