Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing locale during a session

843835Dec 13 2002 — edited Oct 16 2003
Hi,

I've searched the forum, web and everything you can imagine for the answer my question, but not found an answer.

I have the following JSP...

<%@ page language="java" contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<%-- Check whether the user have chosen a language. --%>
<c:if test="${!empty param.language}">
<fmt:setLocale value="${param.language}" scope="session"/>
</c:if>

<%-- Set the resource bundle to use. --%>
<fmt:setBundle basename="client" scope="session"/>

<html>
<head>
<title><fmt:message key="title"/></title>
<style type="text/css">
<!--
@import url(stylesheet/client.css);
-->
</style>
</head>

<body>
<!-- The body of my page. -->
</body>

</html>


This is identical to all examples I've found.

The thing I do not get to work is to change locale during a session. Once the locale is set, it is set as if it was in application scope.

I want users to be able to change language at any point of time during a session.

I use Apache Tomcat/4.1.10 and my properties files are stored in WEB-INF/classes. They are named client.properties, client_en.properties, client_sv.properties, client_de.properties etc...

My language parameter values are en, sv, de etc...

Is this a bug in Tomcat, in JSTL or am I doing anything weird here.

Thank you very much in advance for your help.

Regards, Roger
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 13 2003
Added on Dec 13 2002
10 comments
273 views