aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Drop down box issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Drop down box issue" Watch "Drop down box issue" New topic
Author

Drop down box issue

zaxxon25
Ranch Hand

Joined: Feb 26, 2005
Posts: 35
I have a jsp having drop down box and empty table. This table gets populated on basis of option selected from drop down and clicking button called Search which hits database. This drop down i am populating dynamically from database using Select and option.
My issue is once i have selected an option from drop down say A and clicked on search button the JSP refreshes and populates table below. However i want the option B to be visible in drop down after the page has refreshed. This is not happening and everytime page refreshes the original option of drop down is back in focus.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Then code your serverside page to remember this data and fill it in when the page is rerendered.

Eric
zaxxon25
Ranch Hand

Joined: Feb 26, 2005
Posts: 35
Can i use SelectedIndex property to somehow retain the value in variable.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You should have this value on the server, why don't you set it there?

You can set it in a variable but when the page is submitted it will get wiped clean. You can use cookie, but what if cookies are diabled. Only safe bet is the server.

Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Drop down box issue