1.JSP Code:
Copy Code code as follows:
<%--
Document:index
Created on:2009-10-4, 12:45:43
Author:lucifer
--%>
<% @page contenttype= "text/html" pageencoding= "UTF-8"%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"
"Http://www.w3.org/TR/html4/loose.dtd" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>jsp page</title>
<body>
Get Scheme:
<%=request.getscheme ()%>
<br>
Get Protocol:
<%=request.getprotocol ()%>
<br>
Get Remote Address:
<%=REQUEST.GETREMOTEADDR ()%>
<br>
Get Remote Host:
<%=request.getremotehost ()%>
<br>
Get Server Name:
<%=request.getservername ()%>
<br>
Get Server Port:
<%=request.getserverport ()%>
<br>
Get Header:
<%=request.getheader ("User-agent")%>
<br>
Get method:
<%=request.getmethod ()%>
<br>
Get Request ' s URL:
<%=request.getservletpath ()%>
<br>
Get Request URI:
<%=request.getrequesturi ()%>
<br>
Get Request session ID:
<%=request.getrequestedsessionid ()%>
</body>
2. Output:
Get Scheme:http
Get protocol:http/1.1
Get Remote address:0:0:0:0:0:0:0:1
Get Remote host:0:0:0:0:0:0:0:1
Get Server Name:localhost
Get Server port:8084
Get header:mozilla/5.0 (Windows; U Windows NT 6.0; ZH-CN; rv:1.9.1.3) gecko/20090824 firefox/3.5.3
Get Method:get
Get Request ' s URL:/requests.jsp
Get Request URI:/testrequest/requests.jsp
Get Request Session Id:6ef4eb4a3fe39a15eebd4d46fbd0ba32