注册 登录
编程论坛 WEB前端(UI)

Servlet程序在tomcat上配置好后网页进入显示500错误

小小java菜鸟 发布于 2018-03-18 20:07, 2247 次点击
Servlet源代码(类名:hw.class)
package xxxx;
import *;
import javax.servlet.*;
import javax.servlet.http.*;
public class hw extends HttpServlet{
    public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html><head><title>");
        out.println("This is my first Servlet");
        out.println("</title></head><body>");
        out.println("<h1>Hello,world!</h1>");
        out.println("</body></html>");
    }
}
配置文件web.xml代码
<servlet>
  <servlet-name>hw</servlet-name>
  <servlet-class>hw</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>hw</servlet-name>
  <url-pattern>/hw</url-pattern>
</servlet-mapping>
文件路径:
只有本站会员才能查看附件,请 登录

只有本站会员才能查看附件,请 登录



下图是网页报错
只有本站会员才能查看附件,请 登录

2 回复
#2
小小java菜鸟2018-03-18 20:12
希望有大佬路过能够帮小弟解决一下问题哦,感激不尽
#3
wlrjgzs2018-03-23 23:14
留下联系方式吧
1