Display list item in freemarker page

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Display list item in freemarker page

anjibman
This post was updated on .
Hi I have a DTO  as follow
class MyDTO {
       
        String name
        java.Util.Date acctCreatedDate
        List<County> activeCountyList
}

In ftl I have

<#if name??> ${name} <#else> Test </#if> 
<#if acctCreatedDate??> ${acctCreatedDate} </#if>
<ul>
<#list activeCountyList as activeCounty>
<li>${activeCounty.label}</li>
</#list>
</ul>

"name" is displayed OK.
"acctCreatedDate" is displayed as  "Fri Apr 26 15:37:29 EDT 2013". How can I display as "26/04/2013"?
For list I am getting error
Expected collection or sequence. activeCountyList evaluated instead to freemarker.ext.beans.StringModel

Any help is appreciated.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Display list item in freemarker page

Barrie Selack-2
http://freemarker.sourceforge.net/docs/ref_builtins_date.html

Here are possible date formatting options

Where is activeCounty.label defined> What does your Country bean look like?

Barrie

On May 9, 2013, at 3:07 PM, anjibman <[hidden email]> wrote:

> Hi I have a DTO  as follow
> class MyDTO {
>
> String name
> java.Util.Date acctCreatedDate
> List<County> activeCountyList
> }
>
> In ftl I have
>
> <#if name??> ${name} <#else> Test </#if>
> <#if acctCreatedDate??> ${acctCreatedDate} </#if>
> <ul>
> <#list activeCountyList as activeCounty>
> <li>${activeCounty.label}</li>
> </#list>
> </ul>
>
> "name" is displayed OK.
> "acctCreatedDate" is displayed as  "Fri Apr 26 15:37:29 EDT 2013". How can I
> display as "26/04/2013"?
> For list I am getting error
> Expected collection or sequence. achievements evaluated instead to
> freemarker.ext.beans.StringModel
>
> Any help is appreciated.
>
> Thanks
>
>
>
>
> --
> View this message in context: http://freemarker.624813.n4.nabble.com/Display-list-item-in-freemarker-page-tp4654544.html
> Sent from the freemarker-user mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> FreeMarker-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|

Re: Display list item in freemarker page

anjibman
This post has NOT been accepted by the mailing list yet.
Country DTO is as follow:

Class County {
     String label;
}