Re: Java constants in Freemarker template

Jeromy Evans <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Organization Blue Sky Minds Pty Ltd
Message-ID <[email protected]>
Daniel Dekany wrote:

Saturday, March 29, 2008, 3:16:14 PM, Sunil wrote:

Hi,
Iam developing a portlet application in which Freemarker templates we are
using for View.

Iam trying to use the constants present in Java class file in the freemarker
templates. I have the read the posts which says that we can use java constants
in the Freemarker templates by using the following commands.

${stack.findValue("@fully.classified.classname@constantName")}

That may works like that under a sepcific Web Application Framework
(Struts, I guess), but not in general.

Yes, that's a Struts 2 specific question. The stack object is available
to FreeMarker templates as an alternative to [email protected] My guess is
that you haven't actually executed a Struts2 action prior to rendering
the template so the model has not be setup. You should follow this up
on the Struts 2 user list.

Also ensure you've enable OGNL's access to static methods, which is
disabled by default. Struts2 doesn't expose static methods using the
method Daniel described.

regards,

Jeromy Evans

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.