struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashwin ala <>
Subject Formatting in extended theme using Freemarker
Date Sat, 12 Sep 2009 03:43:55 GMT
We currently display BigDecimal values in <s:textfield> tags in our jsps.
These values need to be formatted to display as currency values. Example:
"123.350000" should display as "123.35"
I extended the simple theme to create a currency theme using only the
text.ftl template file. I basically copied the text.ftl to
/template/currency and changed this line:

<#if parameters.nameValue??>
 value="< value="parameters.nameValue"/>"<#rt/>

to this:
<#if parameters.nameValue??>

This does not work and gives a template error like
 (WARNING: Parameters: Invalid chunk ignored.).

The extended theme by itself does work as this line works:
<#if parameters.nameValue??>
 value="< value="parameters.nameValue*5"/>"<#rt/>
...which multiplies the bigdecimal value by 5 before displaying.

So can anyone let us know what is the best way to apply formatting in an
extended theme in a freemarker template? We also have some date values that
need formatting so will create another theme for that. I could add getText()
to each <s:textfield> tag explicitly but specifying a theme that handles the
formatting seems a lot cleaner. I have also tried freemarker formatting like
the one below with no success


Any help or pointers would be much appreciated.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message