Wendy,
 
Thanks for the quick reply.
books is a session attribute (request.setParameter("books",books)
I retrieve books from database - Book.java 
so books is a "List" object.
Will try your approach and post back the results
Thanks,
Sam~~


Wendy Smoak <[EMAIL PROTECTED]> wrote:
Sam wrote:
> Any clues on best easy ways to do table column sorting
> my rows in the table are generated as follows using 
> as below.

I do it on the server side, holding the items to be sorted in a Map and
creating a new Map passing a Comparator to the constructor to get the
new order. Then when you're back on the JSP iterating over it, the
items are in the "correct" order.

Map accountMap = (Map) session.getAttribute( "accountMap" );
Map newMap = new TreeMap( new CostCenterComparator() );
newMap.putAll( accountMap );
session.setAttribute( "accountMap", newMap );

[Comments welcome, I'm not sure this is the best way to do it, but it
works...]

What type of Collection is 'books' in your example?

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster.

Reply via email to