webtier@glassfish.java.net

JSF and JSTL localisation problem. loosing locale

From: <webtier_at_javadesktop.org>
Date: Thu, 29 Jan 2009 15:48:35 PST

I am working on a JSF application which I would like to localise. Since several pages use JSTL and other user JSF I choose JSTL as follows :

This is the header I am includeing via web.xml prelude feature :
[code]
<%_at_page contentType="text/html"%>
<%_at_page pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>

<fmt:setBundle basename="com.pack.Translations" var="translations" scope="session"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>my.website.com - <fmt:message key="Language" bundle="${translations}"/></title>
</head>
<script src="/scripts/common.js" type="text/javascript"></script>
<body onload="resize();updateAge();" onresize="resize()">
<div class="container">
...
[/code]

I have added the properties package and provided translations. When I log in to the login page (web.xml form based authentication) it displays the correct translation for my browsers header. However any pages there after return in the default translation. It seems that my request local is changes either by the login/session or by JSF.

I would prefer to use the fmt package to do this as I don't need a FacesContext and f:view tags everywhere, instead of f:loadBundle.

Any suggestions if this is a know problem and what I could do to resolve this. I have tried this with the latest JSTL 1.2 and JSF 1.2_12.

Thanks in advance
Alex
[Message sent by forum member 'ejb3workshop' (ejb3workshop)]

http://forums.java.net/jive/thread.jspa?messageID=329122