struts 2国际化不起作用
我正在开发struts 2和spring web应用程序,它支持两种语言:english和hindi。
我已经配置了国际化,但它没有工作,即当我从浏览器更改编码时,文本不会更改。
我试图甚至以编程方式更改语言环境,但它仍然无法正常工作
RegisterAction.java
public class RegisterAction extends ActionSupport {
public String execute(){
return "SUCCESS";
}
public Locale getLocale(){
return new Locale("hi");
}
}
在struts.xml
<action name="register" class="com.medics.action.RegisterAction">
<result name="SUCCESS">/Register.jsp</result>
</action>
Register.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<h4><s:text name="Registration"/></h4>
global-messages.properties
hello=hello
Registration=Registration
global-messages_hi.properties
Registration=\u2354\u2379\u327\u2367\u2344\u2381
这是项目的快照
struts.xml和两个消息文件位于类路径的根目录中
没有找到相关结果
已邀请:
1 个回复
盛梯獭八搽
编辑 如果您确定正在加载英语包,那么您将需要调试应用程序以确认Struts2正确设置了印地语语言环境。您的操作中的断点应该可以让您轻松检查
的值。