有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

带Tomcat的Eclipse上的JavaHTTP状态404(没有生成web.xml)

我正在使用Eclipse和Tomcat9.0开发一个示例,动态web模块4.0,而不生成web。xml部署

项目目录如下:

enter image description here

在哪里反向。java是一个servlet,用于获取输入参数并将其发送回输出页面。 出于某种原因,在我点击submit按钮后,无法访问“/reverse”servlet,tomcat会提示HTTP状态404-Not Found页面。我做错了什么

点击inputForm上的submit按钮后。jsp页面,它得到了错误:

Type Status Report

Message /reverse

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

输入input=“abcd”时我在提交时调用的URL:http://localhost:8080/reverse?input=abcd

我做错了什么?谢谢


共 (1) 个答案

  1. # 1 楼答案

    如果未显式设置上下文根,则默认情况下,它将设置为与项目相同的名称。如果您的项目名为“bla”,那么调用servlet的URL应该如下:http://localhost:8080/bla/reverse