无法使用tomcat7重新加载服务器
我使用 eclipse 和 Tomcat 7 创建了一个 Web 应用程序,我在 html 文件和 java servlet 类中有以下代码 在 html 文件中:
<form action="UserAccessServlet" method = "get">
在 servlet 类中,
@WebServlet ("/UserAccessServlet")
我只做了一些小更改(新的 println 语句),但它没有显示任何效果,我使用以下一段代码
html 文件更改了服务器名称:
但似乎没有重新加载,并且出现以下错误:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您需要在
@WebServlet
标记中指定这一点:I think you need to specify this in your
@WebServlet
tag:我遇到同样的问题,我删除了 web.xml 。
之后,我得到了正确的结果。
另一种方式添加
metadata-complete="true"
像这样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