How can I create a new project inside tomcat webapps folder for running Servlet's?
I followed the exact pattern as mention in lots of tutorials. Even I copy whole project from webapps(default 'examples' project ) and put at same place (webapps) with different name.
But when I trying to call it from browser (http:\localhost:8080\FIRST\MyServlet), I am getting same error as HTTP Status 404 The requested resource is not available.
What am I doing wrong here, or do I have to mention name of new project in some place in tomcat ??
Can someone help me for this issue please?
I have put my Servlet file inside webapps->first->WEB-INF->classes MyServlet.class
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class MyServlet extends GenericServlet
{
public void service(ServletRequest req , ServletResponse res)
throws IOException, ServletException
{
res.getWriter().write("<html><body>Hello</body> </html>");
}
}
and this is my web.xml file at webapps->first->WEB-INF->web.xml
web.xml
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>
web.xmlis code, but it could be a usefull information, thats right - msrd0