This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes Drop Down Box values cannot be retained on JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Drop Down Box values cannot be retained on JSP page" Watch "Drop Down Box values cannot be retained on JSP page" New topic
Author

Drop Down Box values cannot be retained on JSP page

Dinesh Remje
Ranch Hand

Joined: Jan 26, 2010
Posts: 57
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

Joined: May 14, 2004
Posts: 507



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

Joined: Jan 10, 2002
Posts: 60080
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dinesh Remje
Ranch Hand

Joined: Jan 26, 2010
Posts: 57
@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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drop Down Box values cannot be retained on JSP page
 
Similar Threads
How Drop Down Box values can be retained
populate dropdown menu from java method
Jquery form validation
calling a java Script file into the Jsp
Comparing values using JSTL