无法使用tomcat7重新加载服务器

发布于 2024-11-03 07:42:39 字数 939 浏览 8 评论 0原文

我使用 eclipse 和 Tomcat 7 创建了一个 Web 应用程序,我在 html 文件和 java servlet 类中有以下代码 在 html 文件中:

<form action="UserAccessServlet" method = "get">

在 servlet 类中,

@WebServlet ("/UserAccessServlet")

我只做了一些小更改(新的 println 语句),但它没有显示任何效果,我使用以下一段代码

html 文件更改了服务器名称:

java 类:@WebServlet ("/SQA_Servlet")

但似乎没有重新加载,并且出现以下错误:

HTTP Status 404 - /SQA_Learning/SQA_Servlet

--------------------------------------------------------------------------------

type Status report

message /SQA_Learning/SQA_Servlet

description The requested resource (/SQA_Learning/SQA_Servlet) is not available.

我尝试清理模块,刷新,关闭重新打开项目,结果相同

我用 @WebServlet(urlPatterns={"/SQA_Servlet"}) 替换了 @WebServlet ("/SQA_Servlet")

,但仍然没有效果..任何建议。

I created a web application using eclipse and Tomcat 7 I had the following code in the html file and the java servlet class
in the html file:

<form action="UserAccessServlet" method = "get">

in the servlet class I had

@WebServlet ("/UserAccessServlet")

then I just made some small changes (new println statements) but it shows no effect I changed the server name with the following peice of code

html file: <form action="SQA_Servlet" method = "get">
java class: @WebServlet ("/SQA_Servlet")

but it seems that no reload take place and I got the following error:

HTTP Status 404 - /SQA_Learning/SQA_Servlet

--------------------------------------------------------------------------------

type Status report

message /SQA_Learning/SQA_Servlet

description The requested resource (/SQA_Learning/SQA_Servlet) is not available.

I tried clean the module, refresh, close the reopen the project with the same result

I replaced @WebServlet ("/SQA_Servlet") with @WebServlet(urlPatterns={"/SQA_Servlet"})

and still have no effect.. any suggestion.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紫南 2024-11-10 07:42:39

我认为您需要在 @WebServlet 标记中指定这一点:

@WebServlet(name="UserAccessServlet", urlPatterns="/SQA_Servlet")

I think you need to specify this in your @WebServlet tag:

@WebServlet(name="UserAccessServlet", urlPatterns="/SQA_Servlet")
泪眸﹌ 2024-11-10 07:42:39

我遇到同样的问题,我删除了 web.xml 。
之后,我得到了正确的结果。

另一种方式添加 metadata-complete="true" 像这样

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"
    metadata-complete="true">

</web-app>

I encounter the same problem, and I deleted web.xml .
after that, I get the right result.

Another way add metadata-complete="true" like this

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"
    metadata-complete="true">

</web-app>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文