STRUTS2 技术总结.................................................................................................................................2
联系 QQ :745719408..........................................................................................................................2
一:搭建开发环境................................................................................................................................2
1
:导入
jar
包
..................................................................................................................................2
2
:配置
web.xml
文件
.......................................................................................................................2
1):配置 Struts2 过滤器.........................................................................................................................2
2):导入 Struts.xml 配置文件...............................................................................................................3
3
:配置自动提示
.............................................................................................................................3
二:使用 STRUTS 框架..........................................................................................................................3
1:
配置
Action.....................................................................................................................................3
2
:编写
Action
类的方式
................................................................................................................4
1) pojo 方法(直接写一个标准的 Class 类,不需要继承任何的类,实现任何的接口)..................4
2) 实现 Action 接口..................................................................................................................................4
3) 继承 ActionSupport 类.........................................................................................................................4
3
:调用
Action
的方法
.....................................................................................................................4
1)由框架默认调用 execute 方法.............................................................................................................4
2)指定方法让框架调用..........................................................................................................................4
3)动态方法调用...................................................................................................................................... 5
4
:
Struts2
获取
Servlet API
的方式
.................................................................................................6
1):通过 ActionContext 对象获取........................................................................................................6
2):通过接口注入 ................................................................................................................................6
3):通过静态方法调用 .........................................................................................................................6
5
:属性填充方式
.............................................................................................................................7
1) 属性驱动方式......................................................................................................................................7
2) 模型驱动方式......................................................................................................................................7
6
:数据校验方式
.............................................................................................................................8
1) 手工编码校验......................................................................................................................................8
2) 编写 xml 文件校验..............................................................................................................................9
7
:过滤器
........................................................................................................................................11
1) 过滤器编写方式................................................................................................................................11
2) 过滤器配置........................................................................................................................................12
8
:文件上传
...................................................................................................................................12
1):上传文件 ......................................................................................................................................13
9
:文件下载
...................................................................................................................................15
10
:
ongl
表达式
.............................................................................................................................16
1):获取 ValueStack 方法....................................................................................................................17
2):为栈中赋值 ..................................................................................................................................18
3):获取 ognl 表达式的值..................................................................................................................18
4):获取对象中的值 ..........................................................................................................................18
5):访问非值栈的数据...........................................................................................................................19
11:
阻止表达重复提交
....................................................................................................................19
12:ajax
交互
....................................................................................................................................20
评论0
最新资源