I use Displaytag for displaying data in an as400 Work-With Subfile type format in web pages, and it works very well.
One problem I came across was formatting the dates, whilst still using the automatic sorting. I thought I would have to format my data in my POJO and lose the automatic sorting.
But in fact Displaytag solves this problem by allowing you to apply decorators to columns
eg:
package com.decorator;
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
* @author Fabrizio Giustina
* @version $Revision: 1.11 $ ($Author: fgiust $)
*/
public class DatetoDMY implements ColumnDecorator
{
/**
* FastDateFormat used to format the date object.
*/
private FastDateFormat dateFormat = FastDateFormat.getInstance("dd.MM.yyyy HH:mm:ss"); //$NON-NLS-1$
/**
* 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);
}
}
Thursday, December 09, 2004
Subscribe to:
Post Comments (Atom)
Popular Posts
- as400 Iseries Tips
- Common Gateway Interface (CGI) on the as400 / iSeries
- Why Crunch Mode (Long Hours) Doesn't Work
- AS400 Job Scheduler
- Using as400 QRCVDTAQ api to retrieve a message / entry from a dataqueue
- AS400 APIs
- as400 iSeries NetServer Disabled user profiles
- Configuring Tomcat5 and Apache2 with Virtual Hosts using mod_jk
- Adobe Flex 2.0 Beta
- EclipseZone - Clean Up Warnings with the 'restriction' Suppression Flag
uhh...hi
ReplyDeletehow to use this ?
how to use what, displaytag or the decorator?
ReplyDelete