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]
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52)
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)
org.apache.jsp.index_jsp._jspx_meth_s_005ftextfield_005f0(index_jsp.java:122)
org.apache.jsp.index_jsp._jspService(index_jsp.java:93)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


很郁闷自认为struts2.0学的还行,写了个例子报了这个错郁闷的很!!!
最后还是解决了:
首先确保jar包没有问题
(1)JSP页面中没有加入类似下面内容:
<%@ taglib prefix="s" uri="/struts-tags"%>
要支持EL表达式,web2.5的jsp的page 指令要加入isELIgnored="false"后才能够解析EL表达式。今天,就把这个给忘记了,让我郁闷了好久,哎!!!
(2)拦截器的mapping的url就写成/*,不要乱修改配置。刚开始以为配置问题,后来搞了半天
还是之前的错误缓存没清!!汗!!!
<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

注意:struts.xml中的
<result name="input">/XXX.jsp</result> 

不需要type属性

你可能感兴趣的:(java,apache,jsp,struts,servlet)