Bug 19966 - Changing locale during a session
Summary: Changing locale during a session
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.0
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2003-05-15 18:34 UTC by Ajay Soni
Modified: 2005-03-20 17:06 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Ajay Soni 2003-05-15 18:34:04 UTC
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 
%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="WEB-INF/tags/c.tld" %>
<%@ taglib prefix="fmt" uri="WEB-INF/tags/fmt.tld" %>

  Set the locale to the selected one, if any. Otherwise, let the
  <fmt:setBundle> action pick the best one based on the Accept-Language

<%-- Interpret user's locale choice --%>
<c:if test="${param['locale'] != null}"%>
<% System.out.println("here"+request.getParameter("locale"));%>
  <fmt:setLocale value="${param['locale']}" scope="session" /%>

<%-- Offer locale choice to user --%>
<a href="international.jsp?locale=en-US">USA</a> -
<a href="international.jsp?locale=de-DE">Deutschland</a> -
<a href="international.jsp?locale=fr-FR">French;</a>
<%-- Use URL rewriting to ensure proper session tracking --%>
<form method="get" action="<c:url value='/international.jsp' />">
  <input type=submit value="Stay in session">

<fmt:bundle basename="LabelsBundle" >

      <fmt:message key="s0" />
  <body bgcolor="white">
      <fmt:message key="s0" />
Comment 1 Pierre Delisle 2003-06-20 00:08:06 UTC
Fixed in JSTL 1.0.3.