关于过滤器配置的错误 The Struts dispatcher cannot be found
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
at org.apache.jsp.message._404_jsp._jspService(_404_jsp.java:159)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
1.多说是配置问题,但下面为证,确保没错:
XML code
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2.另有说taglib库没有倒入,也确保没错
Java code
<%@ taglib prefix="s" uri="/struts-tags" %>
3.说拦截器执行顺序有错,如在 struts2的FilterDispatcher执行前,自定义的拦截器先执行了。。。怎么可能!
请教其他可能性。靠谱点
------解决方案--------------------struts2没用过,帮你顶!
------解决方案--------------------
新版本(忘了是2点几了)struts2的配置
XML code
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
------解决方案--------------------
自己顶一下,坚持就是胜利!!