You can take a look at the source of displaytag, but here is a simple example:

The LongDateWrapper.java decorator:

package org.displaytag.sample;

import java.util.Date;

import org.apache.commons.lang.time.FastDateFormat;
import org.displaytag.decorator.ColumnDecorator;

/**
 * Simple column decorator which formats a date.
 * @author epesh
 * @version $Revision $ ($Author $)
 */
public class LongDateWrapper implements ColumnDecorator
{
    /**
     * FastDateFormat used to format the date object.
     */
    private FastDateFormat dateFormat = FastDateFormat.getInstance("dd/MM/yyyy");

    /**
     * transform the given object into a String representation. The object is supposed 
to be a date.
     * @param columnValue Object
     * @return String
     */
    public final String decorate(Object columnValue)
    {
        Date date = (Date) columnValue;
        return this.dateFormat.format(date);
    }
}
-----

And call the decorator by doing:

  <display:column property="date" decorator="xxxxxx.LongDateWrapper" />

ok?

Regards,
Bard

----- Original Message -----
From: "Dries Plessers" <[EMAIL PROTECTED]>
Date: Mon, 19 Jul 2004 21:11:00 +0200
To: <[EMAIL PROTECTED]>
Subject: [displaytag-user] Sorting columns

> Hello all,
> 
> does anybody has an example on how to implement column sorting on dates.
> Date format is dd/mm/yyyy.
> 
> thanks!
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
> _______________________________________________
> displaytag-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user

-- 
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
>From your mailbox to local or overseas cell phones.

Powered by Outblaze


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to