thanks much.
sample code by any cance?
Thank you!

~~Sam

Henri Yandell <[EMAIL PROTECTED]> wrote:

BeanUtils' BeanComparator is a useful way to do the sorting by the way,
and will be in your classpath if you're using Struts [depending on
version].

Also ReverseComparator in Commons Collections. Between them you can write
a nice abstract table sorting system.

Hen

On Thu, 4 Mar 2004, as as wrote:

> 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 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.


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