Re: FreeMarker configuration
hezjing <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Thank you, it is working now and here is the Spring configuration,
<bean id="freemarkerConfig"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="freemarkerSettings">
<props>
<prop key="number_format">0.#######</prop>
</props>
</property>
</bean>
BTW, I think it is useful to describe this in the FreeMarker documentation too.
On Tue, May 6, 2008 at 12:49 PM, Daniel Dekany <[email protected]> wrote:
>
> Tuesday, May 6, 2008, 6:06:07 AM, hezjing wrote:
>
> > Hi
> >
> > The FreeMarker's FAQ explains that we can override the number format
> > suggested by the Java platform in the FreeMarker configuration.
> >
> > For example:
> >
> > cfg.setNumberFormat("0.######"); // now it will print 1000000
> >
> >
> > I suppose this is done in Java (?) and so, how can we configure this
> > without writing Java code?
> >
> > If we have no choice but to code in Java to change the FreeMarker's
> > configuration, how would I do it in Spring MVC?
>
> It can be set in the templates with <#setting number_format=...>, but
> you really should NOT do that. Now, I'm nor using Spring, but AFAIK
> there you used to have two beans for FreeMarker, FreeMarkerConfigurer
> and a FreeMarkerViewResolver, right? I believe that the
> FreeMarkerConfigurer has a property called "freemarkerSettings", which
> had java.util.Properties type. And inside that you can specify *all*
> settings of FreeMarker, like:
>
> <props>
> ...
> <prop key="number_format">0.###</prop>
> ...
> </props>
>
> (The "setting" term has a specific meaning in FreeMarker:
> http://freemarker.org/docs/pgui_config_settings.html)
>
> --
> Best regards,
> Daniel Dekany
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
--
Hez
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone