Solved

How to use Alphabetical sorting for values getting from resultset and display the values in a drop down on a jsp page

Posted on 2004-09-15
6
658 Views
Last Modified: 2008-03-03
Hi ,

I have three things to do

1) collect the String values coming from a ResultSet on a specific column name.
2) store  the values into a java collection and sort the collection in Alphabetical order.
3) send the sorted collection to a jsp to be displayed in a drop down.

I have tried using the java.util.List to collect the values and used the Collections.sort()
and i get the the values unsorted and with padding like "[" and " ] " for the all the elements stored in the
list.

I probably can send u guys snippets of code if it helps..

Thanks
Deva
0
Comment
Question by:vdevaruppala
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 9

Expert Comment

by:DrWarezz
ID: 12069367
Yeah, send us what you've got so far please. :)
Thanks,
[r.D]
0
 
LVL 1

Expert Comment

by:elfraga
ID: 12070349
send the code
0
 
LVL 11

Accepted Solution

by:
raj3060 earned 500 total points
ID: 12071206
You can have SQL to do that for you, that is best way to do it. e.g

select * from names orderby lname;

Query like this will bring your data in sorted form like you want.
Another way is like you tried to it. Depends what you are retreiving and how you are storing it. Use arraylist, or vector and then sort it with collection class.
We can tell more if you tell us more and post snippet.
--Raj
0
 
LVL 11

Expert Comment

by:raj3060
ID: 12281228
My suggestion works well for sorting the resultset. I beleive that I should get credit.
-raj
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
A short article about problems I had with the new location API and permissions in Marshmallow
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question