Thanks for your responses. I appreciate that. I used the JSTL to format the date. Will it work using that? Do I have to use decorator itself?
>From: Ed Webb <[EMAIL PROTECTED]> >Reply-To: displaytag-user@lists.sourceforge.net >To: displaytag-user@lists.sourceforge.net >Subject: Re: [displaytag-user] sort not working for Date >Date: Thu, 26 Oct 2006 15:57:50 +0100 > >fea jabi wrote: > > thanks for your reply. > > > > But, we are using 1.0 version which doesn't have format in display >column. > > As, of now we can't use 1.1 version because of servlet constrait. > > > > What else can I try? > > > > Thanks. > > > > > >You could use a decorator. I use the following code to display and sort >newspaper article publication dates. If DisplayTag is sorting the list >by ArticleDate then the decorator returns the date formatted as >yyyyMMddHHmmss. If DisplayTag is displaying the list then the decorator >applies the correct format to display the date nicely. > > /** > * A flag to tell the decorator methods when they're being sorted >and when they're being > * displayed. Set to true by startRow and false by finishRow > */ > protected boolean display = false; > > /** > * A date formatter that allows sorting by date > */ > protected Format sortformat = new SimpleDateFormat("yyyyMMddHHmmss"); > > /** > * Turns on the display flag > */ > public String startRow() { > display = true; > return ""; > } > > > /** > * @param article the article to return the date of > * @return a nicely formatted article date > */ > public String getArticleDate(Article article) { > String date = ""; > Format fmt = article.getSource().getFrequency().getFormat(); > if (display) { > date = fmt.format(article.getArticleDate()); > } else { > date = sortformat.format(article.getArticleDate()); > } > > return date; > } > > /** > * Turns off the display flag. > */ > public String finishRow() { > display = false; > return ""; > } > >Ed! > >------------------------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job >easier >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >displaytag-user mailing list >displaytag-user@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/displaytag-user _________________________________________________________________ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://clk.atdmt.com/MSN/go/msnnkwlo0050000002msn/direct/01/?href=http://www.windowsonecare.com/?sc_cid=msn_hotmail ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user