• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Combo box

 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic