鱼C论坛

 找回密码
 立即注册
查看: 3134|回复: 2

[已解决]Servlet报错,web.xml已经配置完成

[复制链接]
发表于 2018-10-5 19:51:41 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

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

贴下代码
  1. package LoginServlet;

  2. import java.io.IOException;
  3. import java.io.PrintWriter;

  4. import javax.servlet.http.HttpServlet;
  5. import javax.servlet.http.HttpServletRequest;
  6. import javax.servlet.http.HttpServletResponse;

  7. public class LoginServlet extends HttpServlet
  8. {
  9.        
  10.         private static final long serialVersionUID = -5469527586751008772L;

  11.         protected void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException
  12.         {
  13.                 response.setContentType("text/html");
  14.                 PrintWriter out = response.getWriter();
  15.                 out.println("welcome to this S");
  16.         }
  17.        
  18. }
复制代码



web.xml配置文件
  1. <?xml version="1.0" encoding="UTF-8"?>

  2. <web-app>


  3. <servlet>

  4. <servlet-name>LoginServlet</servlet-name>

  5. <servlet-class>LoginServlet.LoginServlet</servlet-class>

  6. </servlet>


  7. <servlet-mapping>

  8. <servlet-name>LoginServlet</servlet-name>

  9. <url-pattern>/LoginServlet/LoginServlet</url-pattern>

  10. </servlet-mapping>

  11. </web-app>
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2018-10-5 23:32:05 | 显示全部楼层    本楼为最佳答案   
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-10-6 10:01:56 | 显示全部楼层
newu 发表于 2018-10-5 23:32
https://blog.csdn.net/dbc_121/article/details/79204340

其次推荐一篇文章《提问的智慧》https://fish ...

多谢啦
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-5 03:19

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表