JSTL and Locale

April 20, 2004


Matt Raible was blogging about JSTL and internationalization in his blog in the entry entitled i18n - synching up Struts and JSTL. The blog talks about how to enable localized app and load the appropriate application resource property file.

We actually had to go the other way in our application. We didn't want to support localization and want to ignore the accept-language tag set in the user’s browser. We wanted to use en_US for everything and we achieved that by adding the following snippet in our web.xml file.


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<!– Set the locale for all JSTL formatting –>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.locale</param-name>
<param-value>en_US</param-value>
</context-param>

No tag for this post.

Related posts

Previous post: No Fluff Just Stuff - Day Three

Next post: Enterprise Java 2 Security: Building Secure and Robust J2EE Applications - Book Review