
sir I want to create an html page which is going to be interact with the servlet program. i want to do it by using eclipse ide can you give me the step by step as well as codes? thanks

Here is a code that displays an interaction between html file and servlet.
1)login.html:
<h1>Login Form</h1> <form action="http://localhost:8080/examples/validservlet"> <Table> <tr> <td>enter name</td> <td><Input Type="text" name="uname"></td> </tr> <tr> <td>enter password</td> <td><Input Type="password" name="pwd"></td> </tr> <tr> <td><Input type="checkbox" value="tick">remember my password</td> </tr> <tr> <td><Input type="submit" value="submit"></td> </tr> <tr> <td><Input type="reset" value="clear"></td> </tr> </table> </form>
2)validservlet.java:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class validservlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw = response.getWriter();
String uname=request.getParameter("uname");
String pwd=request.getParameter("pwd");
if((uname.equals("rose"))&&(pwd.equals("rose"))){
out.println("Welcome");
}
else{
response.sendRedirect("/examples/jsp/login.html");
}
}
}
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.