my dog learned polymorphism*
The moose likes Struts and the fly likes how to reset a selected list box item after search Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to reset a selected list box item after search" Watch "how to reset a selected list box item after search" New topic
Author

how to reset a selected list box item after search

a kishore
Ranch Hand

Joined: Sep 16, 2009
Posts: 82
Hi All,

In my JSP page, i have a select box and search button. after i select one item in select box and do search, i got results. Those results i am displaying on same JSP. But the selected item in select box remain selected. i want that item to be deselected. any suggestion please?

please let me know if i am not clear.

thank you in advance,
kishore
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Try an empty value attribute in the select tag (i.e. value="")...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
a kishore
Ranch Hand

Joined: Sep 16, 2009
Posts: 82
Thanks for replying Ankit,

I tried but canot do that. Actually I could not get you exactly like where i should put that line. can you give me a sample code of lines for that.

thank you,
kishore
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

a kishore wrote: But the selected item in select box remain selected. i want that item to be deselected. any suggestion please?


in struts it is a default[expected] behavior . i dont know why you want to deselect anyway set in your Action class

yourForm.setListBoxVlaue(null);//here setListBoxVlaue is your setter method [i am not sure about your setter method name]

Hope this helps
a kishore
Ranch Hand

Joined: Sep 16, 2009
Posts: 82
thank you seetharaman



regards,
kishore
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

a kishore wrote:thank you seetharaman


You are welcome
a kishore
Ranch Hand

Joined: Sep 16, 2009
Posts: 82
Hi,

i Still couldnt solve my problem.

Here im explaining once again my problem:

once i select an item in select box and search, i get some results and displaying them in same jsp page. but then the selected item in select box remains selected. if i want to search again but without this select box item then i have problem like, the select box item still selected and carrying to my action class and including in search criteria.
how to solve this? please give me one solution.

thanks in advance,
kishore
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to reset a selected list box item after search