|
The encodingFilter should be placed in front of the localeFilter.
<filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>localeFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> After these changes, make sure to clean up the original database and test the new setup using new records. My works for me and it should also work on this case as well. thanks,Scott.
now,the Filter 's sequence is securityFilter-->encodingFilter-->localeFilter. when I opened the default login page(for example,liking http://127.0.0.1/myapp/login.jsp), clicking "Appfuse in English"(<a href="<c:url value='/mainMenu.html?locale=en'/>").because I hadn't login and securityFilter in front of the localeFilter,so the securityFilter redirect the page to ".../login.jsp",value of "request.getParameter("locale")" is null in the LocaleFilter class. so the default login page couldn't switch to english. of course,it also can be resolved following : *****If I set the Filter 's sequence is encodingFilter-->localeFilter-->securityFilter,above issue can be resolved,but i don't whether the new issue will occur or not . *****the other ways, <%c:if test="${pageContext.request.locale.language != 'en'}"> <div id="switchLocale"><a href="<c:url value='/mainMenu.html?locale=en'/>"><fmt:message key="webapp.name"/> in English</a></div> </c:if%> change to following <c:if test="${pageContext.request.locale.language != 'en'}"> <div id="switchLocale"> <a href="<c:url value= '${pageContext.request.requestURL}?locale=en' />"> <fmt:message key="webapp.name"/> in English</a></div> </c:if> if I had login by Locale(zh),in the mainMemu.jsp:
<a href="<c:url value="/selectFile.html"/>"><fmt:message key="menu.selectFile"/></a> <h:commandLink value="#{text['menu.user']}" action="#{userForm.edit}"/> "[menu.selectFile]" ----value was "上传文件" "#{text['menu.user']}" ----value was "编辑信息". after clicking the href(Appfuse in English) "[menu.selectFile]" ----value was "Upload A File " "#{text['menu.user']}" ----value still was "编辑信息",the value should be " Edit Profile" . maybe <f:loadBundle var="text" basename="#{basePage.bundleName}"/> can't switch . The first issue should be fixed. In 1.9.2, you should be able to switch locales without logging in.
|
||||||||||||||||||||||||||||||||||||||||
in the mainMemu.jsp:
<a href="<c:url value="/selectFile.html"/>"><fmt:message key="menu.selectFile"/></a>
[menu.selectFile]----value could switch to english.
<h:commandLink value="#{text['menu.user']}" action="#{userForm.edit}"/>
"#{text['menu.user']}" ---- value couldn't switch to english,it still was Chinese character.