tomcat resource missing, servlet not running
- by user2837260
import javax.servlet.*;
import java.io.*;
public class MyServlet implements Servlet
{
public void init(ServletConfig con) {}
public void service(ServletRequest req, ServletResponse res) throws IOException,ServletException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String s="blah";
String s1="blah";
out.println("<html><body>");
if((s.equals(req.getParameter("firstname")))&&(s1.equals(req.getParameter("pwd"))))
out.println("passwords match");
else
out.println("password and name combo does not match");
out.println("</body></html>");
}
public void destroy() {}
public ServletConfig getServletConfig() { return null;}
public String getServletInfo() { return null;}
}
this is my java file with the servlet class.its saved with the name MyServlet.java and so is the class file.
and here is the xml file:
<web-app>
<servlet>
<servlet-name>demoo</servlet-name>
<servlet-class>MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>demoo</servlet-name>
<url-pattern>/demo</url-pattern>
</servlet-mapping>
</web-app>
i have made the folder as WEB-INF and then classes...
WEB-INF also contains the .xml file
but when i try to run the servlet , it says resource not found
ps- i am already looking for the servlet with the name :demo
localhost:8081/s1/demo*
s1 is the war file
*
a html file in the war file seems to run fine on the server though.
*