Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • ServletRequest Interface with example

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 170
    Comment on it

    The ServletRequest interface have many methods to handle client requests to access a servlet. It is used for access client requests in servlet. HttpServletRequest extends to ServletRequest.

    alt text

    Below example will help you to batter understand :


    <?xml version="1.0" encoding="UTF-8"?>


    <form action="servlet" method="get">  
    <input type="text" name="name"><br>  
    <input type="submit" value="login">  

    import javax.servlet.http.*;  
    import javax.servlet.*;  
    public class ServletDemo extends HttpServlet{  
    public void doGet(HttpServletRequest req,HttpServletResponse res)  
    throws ServletException,IOException  
    PrintWriter out=res.getWriter();  
    String name=req.getParameter("name");
    out.println("Welcome "+name);  

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: