JSP implicit object "request"

The request object is an instance of a servlet API javax.servlet.http.HttpRequest interface. It represents the user request. This implicit object is generally used to get request parameters, request attributes, header information and query string values.
Example of implict object "request" :
index.html
<html> <head> <title>Welcome implict object request example </title> </head> <body> <form action="login.jsp" method="post"> <fieldset> <legend> <font face="Courier New" size="+1" color="red"> Login </font> </legend> <table> <tr> <td>User Name </td> <td> <input type="text" name="userName"> </td> </tr> <tr> <td>Password </td> <td> <input type="text" name="password"> </td> </tr> <tr> <td colspan=2> <input type="submit" value="Login"> </td> </tr> </table> </fieldset> </form> </body> </html>
login.jsp
<%@ page language="java" %> <html> <body> <% String userName=request.getParameter("userName"); out.println("Welcome "+userName); %> </body> </html>
Output
request
request
Download this example
 



 

Latest Tutorial


Most Visited Tutorial