Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drop Down Box values cannot be retained on JSP page

 
Dinesh Remje
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following is the code i have written in a jsp page


Now in the variable 'designation' i am able to get the value selected by user, but i am not able to display the selected value on jsp page.
So in this case what should be done.

Thanks in advance
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Here you have to compare the "designation" that you received from Request attribute and and the one you are retrieving from designations array. If they match set the "selected" property of that option.
The HTML looks like below for the option that is selected.


Regards,
Amit
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scriptlets and Java code in a JSP have been discredited for almost 10 years. It's time to update your JSP knowledge with the JSTL and EL.
 
Dinesh Remje
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@amit thanks amit i was successfully able to do it.
@Bear Bibeault i will keep it in my mind and will try to learn it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic