
while excuting the servlet program, it produce the error as "HTTP 404 not found". i couldnt rectify that error. can you help me to do so?
Serv1.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Serv1 extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException
{
String x= req.getParameter("id");
String y= req.getParameter("pwd");
PrintWriter pw=res.getWriter();
pw.println("<html>");
pw.println("<body>");
pw.println("<h1>Username"+x+"</h1>");
pw.println("<h1>Password"+y+"</h1>");
pw.println("</body>");
pw.println("</html>");
}
}
web.xml
<web-app>
<servlet>
<servlet-name>Serv1</servlet-name>
<servlet-class>Serv1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Serv1</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>
</web-app>

It seems that server is not getting the path properly.
Put your servlet in classes folder. Do servlet mapping in web.xml. Then recompile your code. Restart the server and run your servlet.
For more information, visit the following links:
http://www.roseindia.net/servlets/introductiontoconfigrationservlet.shtml
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.