Servlet程序在tomcat上配置好后网页进入显示500错误
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>
文件路径:
下图是网页报错