Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

How to use JSTL fmt:message and resource bundle (See related posts)

To use JSTL fmt:message tags with a message bundle, there are two ways.

First, if there is only one properties file, use, the following code in web.xml file.

  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContextparam-name>
    class.path.to.your.resources.bundle</param-value>
  context-param>


Use in the JSP.

Second, if there are multiple properties files, and there are different locales, use
<fmt:setBundle basename="class.path.to.your.resources.bundle"/>

before

Or you can write

<fmt:bundle basename="class.path.to.your.resource.bundle">
  <fmt:message key="your.message.key"/>
fmt:bundle>


Comments on this post

collinmanners posts on Aug 04, 2007 at 14:49
this site is good
collinmanners posts on Aug 04, 2007 at 14:50
all is good

You need to create an account or log in to post comments to this site.


Related Posts