Additions to freemarker samples page

This commit is contained in:
rjy7 2010-12-20 20:07:48 +00:00
parent 8c0124819c
commit 900caff315
4 changed files with 8 additions and 17 deletions

View file

@ -91,6 +91,8 @@ public class SamplesController extends FreemarkerHttpServlet {
body.put("year", "2001");
body.put("xsddatetime", "1983-12-07T17:15:28Z");
body.put("title", "Freemarker Samples");
return new TemplateResponseValues(TEMPLATE_DEFAULT, body);

View file

@ -37,15 +37,7 @@ public class TestController extends FreemarkerHttpServlet {
body.put("title", "Freemarker Test");
Calendar cal = Calendar.getInstance();
Date now = cal.getTime();
body.put("now", now);
// In template: ${now?date}, ${now?datetime}, ${now?time}
body.put("datetime", "1983-12-07T17:15:28Z");
return new TemplateResponseValues(TEMPLATE_DEFAULT, body);
}
@Override

View file

@ -2,6 +2,8 @@
<#-- FreeMarker samples -->
<#import "lib-datetime.ftl" as dt>
<h2>${title}</h2>
<@widget name="test" />
@ -13,6 +15,9 @@
<li>Current time: ${now?time}</li>
</ul>
<h3>Formatted datetime</h3>
<p><p>${dt.xsdDateTimeToYear(xsddatetime)}</p>
<h3>Apples</h3>
<ul>
<#list apples as apple>

View file

@ -2,13 +2,5 @@
<#-- FreeMarker test cases -->
<#import "lib-datetime.ftl" as dt>
<h2>${title}</h2>
<p>Current date & time: ${now?datetime}</p>
<p>Current date: ${now?date}</p>
<p>Current datetime: ${now?time}</p>
<p>${dt.xsdDateTimeToYear(datetime)}</p>