问题描述
jsp代码:<%@pagelanguage="java"import="java.util.*"pageEncoding="UTF-8"%><%@taglibprefix="s"uri="/struts-tags"%><html><head></head><body><s:formname="converter"></s:form></body></html>报错内容console报错:严重:Servlet.service()forservletjspthrewexceptionTheStrutsdispatchercannotbefound.ThisisusuallycausedbyusingStrutstagswithouttheassociatedfilter.Strutstagsareonlyusablewhentherequesthaspassedthroughitsservletfilter,whichinitializestheStrutsdispatcherneededforthistag.-[unknownlocation]JSP页面报错:typeExceptionreportmessagedescriptionTheserverencounteredaninternalerror()thatpreventeditfromfulfillingthisrequest.exceptionorg.apache.jasper.JasperException:AnexceptionoccurredprocessingJSPpage/convert.jspatline96:</head>7:8:<body>9:<s:formname="converter">10:</s:form>11:</body>12:</html>Stacktrace:org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)我一步步跟着教程做的了~
解决方案
解决方案二:
myeclipse直接导入的有几个包冲突,去掉了没?
解决方案三:
配置WEB.XML是否正常啊
解决方案四:
你把你的配置发下。可能是过滤器配置错误。
解决方案五:
引用1楼yodlove的回复:
myeclipse直接导入的有几个包冲突,去掉了没?
哪几个包冲突呀?我是新手~刚接触struts2没几天~
解决方案六:
引用3楼closewbq的回复:
你把你的配置发下。可能是过滤器配置错误。
<?xmlversion="1.0"encoding="UTF-8"?><web-appversion="2.5"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>*.action</url-pattern></filter-mapping></web-app>麻烦帮我看一下~谢谢~
解决方案七:
引用3楼closewbq的回复:
你把你的配置发下。可能是过滤器配置错误。
我注册了taglib后还是报错。。。<?xmlversion="1.0"encoding="UTF-8"?><web-appversion="2.5"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><jsp-config><taglib><taglib-uri>struts-tags</taglib-uri><taglib-location>/WEB-INF/struts2-core-2.1.8.1.jar</taglib-location></taglib></jsp-config><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>*.action</url-pattern></filter-mapping></web-app>
解决方案八:
应该是创建struts2的时候只导入了core核心包...没导入标签库吧