gpt4 book ai didi

java - 找不到 Struts 调度程序

转载 作者:行者123 更新时间:2023-12-01 06:17:15 25 4
gpt4 key购买 nike

我在我的代码中发现了一个错误,请帮助我解决我在下面犯的错误。

Build.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<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>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
</web-app>

index.jsp

<s:form action="verify">

<s:textfield name="uname" label="Enter Username"/>
<s:textfield name="pass" label="Enter the Password"/>

<s:submit value="Click" align="center" />

</s:form>

异常

org.apache.jasper.JasperException: 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.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

最佳答案

将 web.xml 文件放在 WEB-INF 文件夹下。我也面临同样的问题,但将 web.xml 文件放在正确的位置解决了问题。

关于java - 找不到 Struts 调度程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21608863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com