I have the following code (Servlet
):
import java.io.*;
import javax.servlet.*;
public class YourServletName implements Servlet{
ServletConfig config=null;
public void init(ServletConfig config){
this.config=config;
System.out.println("servlet is initialized");
}
public void service(ServletRequest req,ServletResponse res)
throws IOException,ServletException{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.print("<html><body>");
out.print("<b>hello simple servlet</b>");
out.print("</body></html>");
}
public void destroy(){
System.out.println("servlet is destroyed");}
public ServletConfig getServletConfig(){return config;}
public String getServletInfo(){return "copyright 2007-1010";}
}
When I run it in Eclipse Luna, I got the following error:
HTTP Status 404 -
type Status report
message
description The requested resource is not available.
Apache Tomcat/8.0.21
Could somebody please tell me why?