配置方案
1全局
可以被整个工程所应用.
只需要在struts.xml文件中配置.
struts.xml
<constant name="struts.custom.i18n.resources" value="messages"></constant> messages.properties 在src根目录
<constant name="struts.custom.i18n.resources" value="cn.itcast.resources.messages"></constant> messages.properties 在 cn.itcast.resources 包
2.针对于包下
配置文件(properties文件)它名字要写 package.properties
3.针对于某一个action
只要配置文件的名称叫做 ActionClass名称.properties
4.自定义位置
在jsp页面上通过struts2提供的国际化标签来操作
<s:i18n name="资源文件的名称"
1全局
可以被整个工程所应用.
只需要在struts.xml文件中配置.
struts.xml
<constant name="struts.custom.i18n.resources" value="messages"></constant> messages.properties 在src根目录
<constant name="struts.custom.i18n.resources" value="cn.itcast.resources.messages"></constant> messages.properties 在 cn.itcast.resources 包
2.针对于包下
配置文件(properties文件)它名字要写 package.properties
3.针对于某一个action
只要配置文件的名称叫做 ActionClass名称.properties
4.自定义位置
在jsp页面上通过struts2提供的国际化标签来操作
<s:i18n name="资源文件的名称"
<s:i18n name="cn.itcast.i18n.a"></s:i18n>
1.jsp页面
使用struts2提供的标签<s:text>
可以通过<s:text>子元素 <s:param>进行传参
2.action使用
getText(); 要求action必须继承ActionSupport。
可以通过 getText(Stirng,String[])进行传参数
3.xml文件使用(校验文件) <message key="">
传参数操作,现在做不了,需要ognl表达式.