步骤:
1)action配置拦截器
2)在form 中放一个<s:token/>标签。可以放在html的<form>中,也可以struts标签的<s:form>中,都一样啦

struts action的xml文件:
...
...
XML code
<action name="save" class="yourAction" method="savepost">
<interceptor-ref name="token"/>
<interceptor-ref name="defaultStack"/>
<result name="invalid.token" >/error/yourError.jsp</result>
<result name="success" >/success.jsp</result>
</action>
...
...

参考地址:http://topic.csdn.net/u/20100728/15/c62d97e3-40e1-4951-a8b3-2640f3677aa9.html