Implicit Objects in JSP, Request Implicit Object in JSP, Methods of Request Objects in JSP


Implicit Objects in JSP, Request Implicit Object in JSP, Methods of Request Objects in JSP

request is the object of HttpServletRequest interface, which is used to get the request from the client and can be used to send the request from one JSP page to another JSP page. The request object has some methods to do these tasks like for getting the request from the client, the some important methods of request object are as follows-


  1. request.getParameter(String name)
  2. request.getQueryString(String querystring)
  3. request.getAttribute(String attribute) 
  4. request.setAttribute(String att_name,ObjectAtt_value) 
  5. request.getParameterNames() 
  6. request.getParameterValues()

Some of other methods are also avalable with request object but those are rarely used.

Example for getting the request from the client

client.html

<html>
<form method="post" action="printValue.jsp">
<input type="text" name="val">
<input type="submit" value="sendValue">
</form>
</html>

server.jsp

<html>
<%
String val=request.getParameter("val");
out.print("The Value you have send "+val);
%>
</html>

Thanks for Visiting

{ 0 comments... read them below or add one }

Post a Comment