struts标签异常 This is usually caused by using Struts tags without the associated f

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.basicinfo.basicInfo_jsp._jspx_meth_struts_005fform_005f0(basicInfo_jsp.java:122)
 at org.apache.jsp.basicinfo.basicInfo_jsp._jspService(basicInfo_jsp.java:93)
 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:386)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
 at java.lang.Thread.run(Thread.java:619)

 

web.xml相关配置如下:

  <filter>
   <filter-name>struts2</filter-name>
   <filter-class>
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
   </filter-class>
 <init-param>
  <param-name>config</param-name>
  <param-value>struts-default.xml,struts-plugin.xml,/config/struts.xml </param-value>
 </init-param>    
  </filter>
  <filter-mapping>
   <filter-name>struts2</filter-name>
   <url-pattern>*.action</url-pattern>
  </filter-mapping>

 

原因是因为过滤器只过滤action结尾的请求

但我在JSP页面中使用了 struts的tag

所以请求不会被struts的过滤器处理

标签也就无法解析

 

修改web.xml即可:

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

 

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