首页 > 学院 > 开发设计 > 正文

Struts2 国际化

2019-11-14 22:51:57
字体:
来源:转载
供稿:网友
Struts2 国际化

方法一:

在struts.xml中配置:

<!--指定常量-->

<constant name="struts.custom.i18n.resources" value="message"/>

<interceptors>

<!-- 指定源文件基名 -->

<interceptor name="i18nCookie" class="org.apache.struts2.interceptor.I18nInterceptor" />

</interceptors>

  配置 

  username=用户名

  --

  username=UserName

   

  在jsp页面中:

<a href="i18n?request_locale=en_US">English</a>|   <a href="i18n?request_locale=zh_CN">中文</a></div>

<!--国际化-->

<s:text name="username">用户名</s:text>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表