This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes dynamic data arranged in alphabetical order in html:select and html:options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "dynamic data arranged in alphabetical order in html:select and html:options" Watch "dynamic data arranged in alphabetical order in html:select and html:options" New topic
Author

dynamic data arranged in alphabetical order in html:select and html:options

pavani potnuru
Greenhorn

Joined: Nov 04, 2007
Posts: 11
Hi
I am displaying items form data base in a jsp in a dropdown list using html:select and html ption tag. Now I have to display them in alphabetical order according to a property(legalBusinessName).Help me out in this. This is the piece of code..

<html:select
property="legalBusinessName" styleClass="select"
styleId="legalName" onchange="fetchUserDetails()">
<html ption value="-1">---select---</html ption>
<html ptions collection="accountNamesList" property="acctId"
labelProperty="legalBusinessName" />
</html:select></td>
[ December 06, 2007: Message edited by: Ben Souther ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If the data is coming from a database, then the easiest way to sort them is to do it when you pull them by using an "ORDER BY" clause.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: dynamic data arranged in alphabetical order in html:select and html:options
 
Similar Threads
html:select and html:options question
form validation error
HTML:SELECT
html:select - maintain incoming value in drop down box
bean:message tag in option tag. is there a solution?