struts2框架搭建第三天

来源:互联网 发布:笔记本电脑端口设置 编辑:程序博客网 时间:2024/04/27 17:42

1, Result  的type属性

redirectAction :重定向到一个action
redirect :重定向到界面

dispacher: 转发到jsp(默认)
chain:转发到action (使用此类型转发时在<result>标记内需要加入 <param>标记以制定 ,该转向的action名称和 命名空间。)

例如:
<param type="actionName">action的名字</param>
<param type="namespace">/命名空间的名字</param>


2,拦截器

1,Interceptor 接口

2, AbstractInterceptor 适配器模式(抽象类)

3,MethodFilerInterceptor 进行更细致的过滤 (抽象类)

 

=================

1,国际化:

i18n:Internationnalization

1,struts.xml
<constant name="struts.custom.i18n.resources" value="globalMessage"></constant>


2,命名规范: properties
globalMessage_en_US.properties
user="UserName"
globalMessage_zh_CN.properties
user="用户名";

3,引入struts2标签

<s:text name="user"></s:text>

原创粉丝点击