Advertisement
Methods | Description |
---|---|
Object getAttribute(String name) | This method returns the value of the attribute named name. |
Enumeration getAttributeNames() | This method returns the name of all attributes in an HTTP request. |
String getParameter() | This method returns the value of request parameter as String or null if parameter doesn't exist. |
Enumeration getParameterNames() | This method returns the names of all parameters in request. |
String getContentType() | This method returns the MIME type of the request or null for an unknown type. |
String getProtocol() | This method returns name of the protocol and its version used by the request. |
String getRemoteAddr() | This method returns IP address that the request came from. |
String getServerName() | This method returns the name of Server that received the request. |
int getServerPort() | This method returns Server port at which the request is received. |
boolean isSecure() | This method returns true if the request came from HTTPS protocol and false if it didn't. |
Cookies getCookies() | This method returns an array of Cookie objects that came along with this request. |
String getMethod() | This method returns the name of the method(GET, PUT, POST) using which the request was made. |
String getRequestURI() | This method returns the URI of the page that initiated the request. |
Advertisement
<html>
<head>
<title>Using JSP built-in request object</title>
</head>
<body>
<h2>Information retrieved from the request object - </h2>
JSP request came from : <%= request.getRequestURI() %> <br/>
Protocol of request : <%= request.getProtocol()%> <br/>
IP address of request : <%= request.getRemoteAddr() %> <br/>
Server name : <%= request.getServerName()%> <br/>
Server Port : <%= request.getServerPort() %> <br/>
Is request secure : <%= request.isSecure() %> <br/>
Content-type of request : <%= request.getContentType() %> <br/>
JSP request method : <%= request.getMethod() %> <br/>
</body>
</html>
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement