程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> JSP編程 >> 關於JSP >> JSP 不能用 不支持 STRUTS標簽 報錯 The Struts dispatcher cannot be foun

JSP 不能用 不支持 STRUTS標簽 報錯 The Struts dispatcher cannot be foun

編輯:關於JSP

JSP頁加了<%@ taglib prefix="s" uri="/struts-tags"%> 以後,運行顯示報錯: Servlet.service() for servlet jsp threw exception 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.messageBoard.showMessage_jsp._jspx_meth_s_005fiterator_005f0(showMessage_jsp.java:148)  at org.apache.jsp.messageBoard.showMessage_jsp._jspService(showMessage_jsp.java:119)  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:374)  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)  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.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)  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:128)  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:286)  at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)  at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565) www.2cto.com
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)  at java.lang.Thread.run(Thread.java:619)         其實 好辦,只要在WEB.XML中加入一個過濾器就行了:   [html]   <span style="font-size:18px;"><filter-mapping>    <filter-name>struts2</filter-name>    <url-pattern>*.jsp</url-pattern>    </filter-mapping> </span>  

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved