File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets 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: 511



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: 60766
    
  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
Comparing values using JSTL
Jquery form validation
calling a java Script file into the Jsp
How Drop Down Box values can be retained
populate dropdown menu from java method