postheadericon 12. Write a Servlet to display parameters available on request.




Index.html

<html>
<head>
<title>EX-12: WTAD : www.bipinrupadiya.com</title>
</head>
<body>

<form action="/Ex12/bipinrupadiya.blogspot.com" method="get">
<br>User:<input type="text" name="usr">
<br>
Password : <input type="text" name="pwd">
<br>
<input type="Submit" value="Login"><input type="reset" value="Clear">
</form>

<body>
</html>



Servlet



import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.WebServlet;

@WebServlet(
name="WTAD",
urlPatterns={"/Ex12","/bipinrupadiya.blogspot.com"}
)

public class readLogin extends HttpServlet
{
  public void doGet(HttpServletRequest request,HttpServletResponse response)
      throws ServletException, IOException
 {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<br><B>USER :</B>: "
                + request.getParameter("usr") +
                "<br><B>Password</B>: "
                + request.getParameter("pwd") +
                 "");
  }
}


output





0 comments:

Follow by Email

Blog Archive

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.