Java web.xml错误页404错误路径

Java web.xml错误页404错误路径,java,spring,http-status-code-404,web.xml,Java,Spring,Http Status Code 404,Web.xml,我有以下web.xml文件: 调度员服务 org.springframework.web.servlet.DispatcherServlet 上下文配置位置 类路径:spring/mvc-config.xml 1. 调度员服务 / 404 /index.html 当我转到localhost:port/myapplication/someincorrectrl时,它会正确地将我重定向到index.html文件。但是当我转到localhost:port/myapplication/someinc

我有以下web.xml文件:


调度员服务
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
类路径:spring/mvc-config.xml
1.
调度员服务
/
404
/index.html

当我转到
localhost:port/myapplication/someincorrectrl
时,它会正确地将我重定向到index.html文件。但是当我转到
localhost:port/myapplication/someincorrectrl1/someincorrectrl2
时,应用程序会给我一个404错误。如何解决具有多个路径的错误URL问题?

如果您在Tomcat上部署了应用程序,并且只需键入localhost或localhost:port,它将不会重定向到您的应用程序

您可以通过键入localhost:port/YourProjectName进行访问。它是项目的根目录,如果要访问任何其他资源,可以通过localhost:port/YourProjectName/OtherResource访问它。如果OtherResource不存在,并且您已将404错误映射到index.jsp,它将重定向到index.jsp


您错误地给出了根路径和子路径。

更正我忘记在问题中添加应用程序。我刚刚编辑过。将它添加到web.xml项目名称中,你现在面临同样的问题吗?@sajid我也有同样的问题,你能帮我解决同样的问题吗,我可以知道你是如何解决的吗