最近更换了struts2的jar包,升级成struts2.16。之后过程中有2点注意。
1、web.xml文件中dispatch的路径改为
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
2、整合为dwr后,你会发现struts2.16不再辨别dwr的路径,它也会自动去过滤dwr请求,造成错误,所以需要在
struts.xml中加入
<constant name="struts.action.extension" value="action"></constant>
让其只对.action扩展名进行拦截,如果你还要拦截其他扩展名,可以写成 action,jsp 等