<% @ page language="Java" import="Java. Util. *" pageEncoding="utf-8" % >

<! PUBLIC DOCTYPE HTML "-////W3C DTD HTML 4.01 Transitional//EN" >
<Html>
<Head>
<Title> JSP and JSTL access server parameter </title>
</head>
<Body>
JSP mode <Br/>
<%

String SERVER_NAME=request. GetServerName ();

String SERVER_SOFTWARE=getServletContext () getServerInfo ();

String SERVER_PROTOCOL=request. GetProtocol ();

Integer SERVER_PORT=request. GetServerPort ();

String REQUEST_METHOD=request. GetMethod ();

String the PATH_INFO=request. GetPathInfo ();

String just=request. GetPathTranslated ();

String SCRIPT_NAME=request. GetServletPath ();

String DOCUMENT_ROOT=request. GetRealPath ("/");

String QUERY_STRING=request. The getQueryString ();

String REMOTE_HOST=request. GetRemoteHost ();

String REMOTE_ADDR=request. GetRemoteAddr ();

String the AUTH_TYPE=request. GetAuthType ();

String REMOTE_USER=request. GetRemoteUser ();

String CONTENT_TYPE=request. The getContentType ();

Integer CONTENT_LENGTH=request. GetContentLength ();

String HTTP_ACCEPT=request. The getHeader (" Accept ");

String HTTP_USER_AGENT=request. The getHeader (" the user-agent ");

String HTTP_REFERER=request. The getHeader (" Referer ");

HashMap infoMap=new HashMap ();

infoMap. Put (" SERVER_NAME, "SERVER_NAME);

infoMap. Put (" SERVER_SOFTWARE SERVER_SOFTWARE);

infoMap. Put (" SERVER_PROTOCOL SERVER_PROTOCOL);

infoMap. Put (" SERVER_PORT SERVER_PORT);
infoMap. Put (" REQUEST_METHOD, "REQUEST_METHOD);

infoMap. Put (" the PATH_INFO ", the PATH_INFO);

infoMap. Put (" PATH_TRANSLATED ", just);

infoMap. Put (" SCRIPT_NAME SCRIPT_NAME);

infoMap. Put (" DOCUMENT_ROOT DOCUMENT_ROOT);

infoMap. Put (" QUERY_STRING QUERY_STRING);

infoMap. Put (" REMOTE_HOST REMOTE_HOST);

infoMap. Put (" REMOTE_ADDR "REMOTE_ADDR);

infoMap. Put (" the AUTH_TYPE ", the AUTH_TYPE);

infoMap. Put (" REMOTE_USER REMOTE_USER);

infoMap. Put (" CONTENT_TYPE CONTENT_TYPE);

infoMap. Put (" CONTENT_LENGTH, "CONTENT_LENGTH);

infoMap. Put (" HTTP_ACCEPT HTTP_ACCEPT);

infoMap. Put (" HTTP_USER_AGENT ", HTTP_USER_AGENT);

infoMap. Put (" HTTP_REFERER ", HTTP_REFERER);

Iterator it.=infoMap keySet (). The Iterator ();

% >

<.
% while (it hasNext ()) {
Object o=it. The next ();
% >
<% %=o >
<% %=infoMap. Get (o) >
<% out. The println ("
"); } % >
<Br/>

JSTL way <Br/>
${pageContext. Request} | get request object <Br>
${pageContext. Session} | get the session object <Br>
${pageContext. Request. The queryString} | obtain the parameters of the request string <Br>
${pageContext. Request. RequestURL} | requested URL, but does not include the request of the argument string <Br>
${pageContext. Request. ContextPath} | service web application name <Br>
${pageContext. Request. Method} | GET HTTP method (GET, POST) <Br>
${pageContext. Request. Protocol} | made use of protocols (HTTP/1.1, HTTP/1.0) <Br>
${pageContext. Request. The remoteUser} | get user name <Br>
${pageContext. Session. New} | to determine whether a session for the new and the new session, said just generated by the server and the client has not yet use <Br>
${pageContext. Session. Id} | get ID< session; Br>

${header [" the user-agent "]} | the version of the User's browser <Br/>
${header (" Host ")} | IP
${pageContext. Request. RemoteAddr} | get the IP address of the user <Br>
${pageContext. ServletContext. ServerInfo} | host the service information <Br>
${pageContext. Request. ServerPort} | port information <Br>
${pageContext. Request. ServerName} | server name <Br>
${pageContext. Request. RemoteHost} | client name <Br>
</body>
</html>


This concludes the body part