JSP request implicit object
The JSP request is an implicit object of type
HttpServletRequest i.e. created for each jsp request by the web container. It
can be used to get request information such as parameter, header information,
remote address, server name, server port, content type, character encoding etc.
It can also be used to set, get and remove attributes from the jsp
request scope.
Example of JSP request implicit object
index.html
<form action="welcome.jsp">
<input type="text" name="uname">
<input type="submit" value="go"><br/>
</form>
<form action="welcome.jsp">
<input type="text" name="uname">
<input type="submit" value="go"><br/>
</form>
welcome.jsp
<%
String name=request.getParameter("uname");
out.print("welcome "+name);
%>
<%
String name=request.getParameter("uname");
out.print("welcome "+name);
%>
Output
Fig: JSP Request Object |
No comments:
Post a Comment