Bug 19966 - Changing locale during a session
Summary: Changing locale during a session
Status: RESOLVED FIXED
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
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-15 18:34 UTC by Ajay Soni
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments

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 
session.
%@ 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
  header.
--%>

<%-- 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" /%>
</c:if%>

<%-- 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">
</form>

<fmt:bundle basename="LabelsBundle" >



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