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和两个消息文件位于类路径的根目录中     
已邀请:
不幸的是,您将键命名为与英语值相同,因此您无法确定英语包是否正确加载。我的第一个猜测是Struts不知道全局消息* .properties是语言包。 尝试将此添加到struts.xml:
<constant name="struts.custom.i18n.resources" value="global-messages"/>
编辑 如果您确定正在加载英语包,那么您将需要调试应用程序以确认Struts2正确设置了印地语语言环境。您的操作中的断点应该可以让您轻松检查
getLocale()
的值。     

要回复问题请先登录注册