File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Freemarker Syntax for Accessing Messages in Resource Bundle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Freemarker Syntax for Accessing Messages in Resource Bundle" Watch "Freemarker Syntax for Accessing Messages in Resource Bundle" New topic
Author

Freemarker Syntax for Accessing Messages in Resource Bundle

R Rauser
Greenhorn

Joined: May 21, 2008
Posts: 1
Hi everyone,

I'm moving from JSPs to FTLs for presentation in a Struts 2 web app and I'm wondering how I can access messages in a resource bundle using Freemarker?

Basically I'm looking for a Freemarker equivalent to something like


where application.name is defined in my package.properties bundle sitting somewhere high up in my package hierarchy.

Thanks for any help!
uthaman udayakumar
Greenhorn

Joined: Sep 25, 2008
Posts: 3
Hi,

you have to import the strtus tag library.. and embed the whole set of code inside (here the name is the resource bundle name) the code goes here
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The S2 tags area automatically imported; you should just be able to use:See the S2 FreeMarker docs for more info.

Note that there are some caveats when using the FM tags. FM tags are defined to be block or inline, and cannot be both (at least at this point, as far as I know). Some tags, like the "action" tag, are defined as an inline tag, disallowing the use of nested tags (like the "param" tag). For the most part this isn't an issue, but can be troublesome at times.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Freemarker Syntax for Accessing Messages in Resource Bundle
 
Similar Threads
Custom ResourceBundle class?...
Problem with placeholders of Resource Bundle file when upgaraded to Freemarker 2.3.18 jar
How to display a message resource value using an argument via <h:outputText>
Constants Class
Struts Validator