Java HTTP 状态 404 Eclipse Tomcat 7

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22797521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 17:58:20  来源:igfitidea点击:

HTTP Status 404 Eclipse Tomcat 7

javaeclipsejsptomcat

提问by user1282256

I am getting Error 404 when trying to run my application. Tomcat server, start and synchronized. Dynamic module version is 2.5. Previously I used dynamic module version 3.o but it didn't work. I read in one of the posts that better is to use 2.5. so I created new project and still get this 4044 error. It is technical error I think.

尝试运行我的应用程序时出现错误 404。Tomcat 服务器,启动并同步。动态模块版本为 2.5。以前我使用动态模块版本 3.o 但它不起作用。我在其中一篇文章中读到最好使用 2.5。所以我创建了新项目,但仍然收到此 4044 错误。我认为这是技术错误。

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

采纳答案by user1282256

I needed to create index.jsp WebContent->New->JSP file and it will place it in the right spot. Now I am able to see my index page.

我需要创建 index.jsp WebContent->New->JSP 文件,它会将它放在正确的位置。现在我可以看到我的索引页了。

The problem was that I created index.jsp file WEB-INF->New->JSP file. You can see it above in my post.

问题是我创建了 index.jsp 文件 WEB-INF->New->JSP 文件。你可以在我的帖子上面看到它。

Here I place the image where you can see image.jsp is place in different spot. You can see small difference.

在这里,我将图像放置在您可以看到的地方 image.jsp 位于不同的位置。你可以看到细微的差别。

enter image description here

在此处输入图片说明

回答by spiderman

That's why I asked you to create a test dynamic project to compare. I think when you created that new project you placed index.html under WebContent correctly. So you couldn't figure out with that example.

这就是为什么我要求您创建一个测试动态项目进行比较。我认为当您创建该新项目时,您将 index.html 正确放置在 WebContent 下。所以你无法弄清楚那个例子。

Also you can place your jsp inside WEB-INF. That's a recommended way too to keep it safe . I mean if the file is inside WebContent a Web user can navigate to the location and access it. But if it is inside WEB-INF the access is controlled by your web.xml. So in your former case just give the relative path .ie /WEB-INF/page.jsp

您也可以将您的 jsp 放在 WEB-INF 中。这也是保持安全的推荐方法。我的意思是如果文件在 WebContent 中,Web 用户可以导航到该位置并访问它。但是,如果它在 WEB-INF 中,则访问由您的 web.xml 控制。所以在你以前的情况下,只需给出相对路径 .ie /WEB-INF/page.jsp