1. execAndWait interceptor 必须被配置为最后一个interceptor。execAndWait创建的线程只会执行action,在execAndWait之后的interceptor都不回被调用。
search-wait.jsp
<%@ taglib prefix="ww" uri="webwork" %>
<html>
<head>
...
<meta http-equiv="refresh" content="5;url=<ww:url includeParams="all"/>"/>
...
</head>
</html>
2. <ww:token/>
<ww:token name="category.token"/>
--to html-->
<input type="hidden" name="webwork.token.name" bbbbbvalue="category.token"/>
<input type="hidden" name="category.token" bbbvalue="***32位字符***"
并使用TokenInterceptor或者TokenSessionStoreInterceptor(handleValidToken()在session中保存actionInvocation和token的对象,如有重复提交,则从session中取出)
3.通过配置浏览器查看配置
(1)得到webwork-config-browser.jar文件,并放在WEB-INF/lib下面。
(2)修改xwork.xml<include file="config-browser.xml"/>
(3)修改velocity.properties,添加一个使用配置浏览器末班的宏:
#Velocity宏库
#webwork.vm是webwork的基础库
#tigris-macros.vm是配置浏览器的基础库
velocitymacro.library = webwork.vm, tigris-macros.vm
(4)重启web应用,通过http://localhost:8080/myApp/configbrowser/actionNames.action访问配置浏览器。
4.重新加载资源
在webwork.properties里面设置webwork.configuration.xml.reload=true,则xwork.xml、*-validation.xml、*-conversion.properties在修改之后会被重新加载。
com.opensymphony.xwork.util.LocalizadTextUtil.setReloadBundles(boolean reloadBundles)
只适应于属性文件的ResourceBundles。
5.使用mock对象
MockObjects(http://mockobjects.com)
EasyMock(http://easymock.org).
6. interceptor必须是无状态的,并且不能使用任何ActionInvocation提供的范围以外的API。
7. 表达式语言 jstl groovy velocity ognl