This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to retain selected value.....

 
reddy kl
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
i have two listboxes and when i selected one item in first listbox and submitting the form,am getting the items in next listbox according the item selected in the first listbox from the database.but the item which i selected in first listbox is not appearing but taking the default value...
how to retain that item..plz note that the items in first listbox are also from database...
can any one help me out with code snippet..
thanks in advance..
regd
dev
 
mahadev ramalingam
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
place the selected value or index in a hidden text box or in a variable and then assign it to the select box using javascript. this gets selected when the values come from the d/b into the second select box.
Hope this helps u.
 
Prashanth menon
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi devender
As I can understand you submit from first page having a listbox(first) , you have to get this in the second page which has second listbox with the current selected value as the one you just selected.
try this in second jsp

I thing this is what you wanted.
rgds
pranth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic