Home.java文件
RequestDispatcher view = request.getRequestDispatcher("/WEB-
INF/views/Login.html");
view.include(request, response);
web.xml文件
这有效 -
<servlet>
<servlet-name>Home</servlet-name>
<servlet-class>home.Home</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Home</servlet-name>
<url-pattern>/home</url-pattern>
</servlet-mapping>
这不起作用 -
<servlet>
<servlet-name>Home</servlet-name>
<servlet-class>home.Home</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Home</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
在第二种情况下,控制台中存在重复错误打印。
SEVERE: Servlet.service() for servlet [Home] threw exception
java.lang.StackOverflowError
at javax.servlet.ServletRequestWrapper.isAsyncStarted(ServletRequestWrapper.java:409)
at javax.servlet.ServletRequestWrapper.isAsyncStarted(ServletRequestWrapper.java:409)
at javax.servlet.ServletRequestWrapper.isAsyncStarted(ServletRequestWrapper.java:409)
我在stackoverflow上发现了关于相同错误的问题,但我无法理解其中的任何错误
java.lang.StackOverflowError being thrown by class that doesn't exist