- 2
- 0
- 约3.19万字
- 约 29页
- 2017-08-05 发布于河南
- 举报
struts2
1.struts2框架引入到web项目中
1.把struts2相关的jar包引入到项目中;
2.把struts2的配置文件直接放到src下面,名字要叫做struts.xml。(运行的时候配置文件会被框架自动读取)
注意:如果struts.xml文件中不能自动提示标签,把相应的dtd文件配置上去
3.在web.xml文件中配置struts2框架的过滤器;
这个拦截器的作用:拦截struts2框架中的action
注意:如果不配置这个filter,struts框架就无法工作
第一种配置方式:
struts2框架2.0版本使用的方式
struts2框架2.0以上的版本也可以使用
filter
filter-namestruts2/filter-name
filter-classorg.apache.struts2.dispatcher.FilterDispather/filter-class
/filter
filter-mapping
filter-namestruts2/filter-name
url-pattern/*/url-pattern
/filter-mapping
第二种配置方式:
struts2框架2.0以上的版本使用的方式
这个过滤器是2.0以上版
原创力文档

文档评论(0)