struts2对webwork的改进之处:
1.webwork.properties文件中变量现在可以配置在下列文件(这是struts2自带文档中的说的):
struts-default.xml
struts-plugin.xml(在每个plugin的jar包中)
struts.xml(用constant元素)
struts.properties(没有默认文件,可选,与webwork.properties文件相似,每个项目可以有这个文件)
web.xml
下面是struts2自带文档中的示例
Constant Example (struts.xml)
<struts>
<constant name="struts.devMode" value="true" />
...
</struts>Constant Example (struts.properties)
struts.devMode = trueConstant Example (web.xml)
<web-app id="WebApp_9" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
<init-param>
<param-name>struts.devMode</param-name>
<param-value>true</param-value>
</init-param>
</filter>
...
</web-app>
2.加入了通配符的支持,这是在ww2中没有的,如下:
<action name="*" >
<result>/tutorial/{1}.jsp</result>
</action>