Summary: | fmt:setLocale value can't be changed | ||
---|---|---|---|
Product: | Taglibs | Reporter: | Pere Soler <psrubi> |
Component: | Standard Taglib | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | All | ||
Attachments: | Example <fmt> usage that doesn't work fine. |
Description
Pere Soler
2003-02-04 09:11:56 UTC
Created attachment 4738 [details]
Example <fmt> usage that doesn't work fine.
The attachment is a war file that contains an example of <fmt> usage that doesn't work fine. I attached with the name fmtexample.war. It can be deployed simply copying the war file to the deploy directory. The sample code provided fails to give the proper locale because <fmt:setLocale> is used erroneously. The code in manager.jsp has the following: <fmt:setLocale value="<%=lang%>" scope="session"/> This should throw an exception at translation time because attributes in EL tag libraries have <rtexprvalue> set to false. The string literal "<%=lang%>" is passed as is to the tag handler. You can fix your sample code in the following ways and it will then work fine. Use the RT tag library: <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt_rt" %> ... <fmt_rt:setLocale value="<%=lang%>" scope="session"/> Or expose the scripting variable as a scoped variable and use the EL taglib: request.setAttribute("lang", lang); ... <fmt:setLocale value="${lang}" scope="session"/> Thank you and sorry for my error. |