近期在给客户调试应用的时候,遇见一个比较郁闷的问题,原本用tomcat5.0.28,应用一切正常,发现APACHE发布了TOMCAT 7.0.2后,就把自己使用的TOMCAT换成了7.0.2版本,结果发现DWR狂报DWR CSRF Security Erro错误,郁闷中.....后来请教GOOGLE大神,发现需要在web.xml中DWR的配置上加上一段:
<init-param> <param-name>crossDomainSessionSecurity</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>allowScriptTagRemoting</param-name> <param-value>true</param-value> </init-param>
修改成:
<servlet> <servlet-name>dwr-invoker</servlet-name> <servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>crossDomainSessionSecurity</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>allowScriptTagRemoting</param-name> <param-value>true</param-value> </init-param> </servlet>
就好了