2013年11月18日星期一

struts2.x international issues

login.jsp page form below
<s:form action="login" method="post">
      <s:textfield name="userName" key="loginUserName" ></s:textfield>
      <s:password name="userPassword" key="loginUserPassword" ></s:password>
      <s:submit key="submit"></s:submit>
     </s:form>


There are two resource files are located WEB-INF/classess myResources_en_US.properties and myResources_zh_CN.properties directory

in the url address bar after typing http://localhost:8080/PrrojectName/login.jsp?request_locale=en_US
login.jsp page is always displayed in the Chinese myResources_zh_CN.properties instead myResources_en_US.properties inside the English which is why ,?
------ Solution - -------------------------------------------
struts internationalization is to use struts tag can be achieved, the performance is quite slow,
You can come to my blog to see examples of that project , I engaged in a scheme
http://blog.csdn.net/shadowsick/article/details/8903278
------ Solution ------------------- -------------------------
this tag
------ For reference only ---------------------------------------
way upstairs nor ah
<s:a value="login.jsp">
     <s:param name="request_locale" value="'en_US'" />
     链接
     </s:a>


still is when I click on the link , when the address bar displays http://localhost:8080/PrrojectName/login.jsp?request_locale=en_US

but always login.jsp page is loaded myResources_zh_CN.properties how to load the resource file is not required myResources_en_US.properties computers to download English language pack ?
------ For reference only -------------------------------------- -
as shown upstairs , which is set in the control panel area for the United States , which set the browser language preference to English,
problem can be solved

没有评论:

发表评论