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
602 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
  • 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now