This question already has an answer here:
- Servlet returns “HTTP Status 404 The requested resource (/servlet) is not available” 8 answers
To be honest i am a learner and this is my first ever servlet program. I made the basic servlet and intalled tomcat version 6 and even tomcat version 8. the server starts up correctly and i am able to see the tomcat start up page on going to
http://localhost:8080
but after logging to tomcat manager when i click on my folder name it gives me an error saying
http status 404-/online/ (online is my folder created in webapps)
type Status report
message /online/
description The requested resource is not available.
here's my codes
web.xml-> (in folder online->WEB-INF)
- <web-app>
- <servlet>
<servlet-name>FirstServlet</servlet-name>
<servlet-class>FirstServlet</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>FirstServlet</servlet-name>
<url-pattern>/FirstServlet</url-pattern>
</servlet-mapping>
</web-app>
FirstServlet.java->
import javax.servlet.*;
import java.io.*;
class FirstServelet implements Servlet
{
public void init(ServletConfig config)
{
}
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
PrintWriter out;
out=response.getWriter();
out.println("hello");
out.println("<html>");
out.println("<head>");
out.println("<title>MY First Servlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<marquee>ban ja tar pls</marquee>");
out.println("</body>");
out.println("</html>");
}
public String getServletInfo()
{
return null;
}
public ServletConfig getServletConfig()
{
return null;
}
public void destroy ()
{
}
}
please resolve the 404 error