struts2使用<s:token/>报错

java.lang.NullPointerException

org.apache.struts2.util.TokenHelper.setToken(TokenHelper.java:71)

org.apache.struts2.components.Token.buildToken(Token.java:114)

org.apache.struts2.components.Token.evaluateExtraParams(Token.java:96)

org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:856)

1.问题原因:为了使用<jsp:forwardpage=""></jsp:forward>,我配置了

<filter-mapping>

<filter-name>struts2</filter-name>

<url-pattern>/*</url-pattern>

<dispatcher>REQUEST</dispatcher>

<dispatcher>FORWARD</dispatcher>

</filter-mapping>

2.解决方法:

去掉<dispatcher>REQUEST</dispatcher>

<dispatcher>FORWARD</dispatcher>

改用:<%response.sendRedirect("");%>跳转

相关推荐