<%
String path = request.getContextPath();
String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
%>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<base href=”<%=basePath%>”>
<title>My JSP “request.jsp” starting page</title>
<meta http-equiv=”pragma” content=”no-cache”>
<meta http-equiv=”cache-control” content=”no-cache”>
<meta http-equiv=”expires” content=”0″>
<meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
<meta http-equiv=”description” content=”This is my page”>
<!–
<link rel=”stylesheet” type=”text/css” href=”styles.css”>
–>
</head>
<body>
<form action=”request.jsp” method=”post”>
<input type=”text” name=”usename”/>
<input type=”submit” value=”提交”/>
</form>
请求方法名: <%=request.getMethod()%> <br/>
请求资源: <%=request.getRequestURI()%><br/>
请求使用的协议: <%=request.getProtocol()%><br/>
请求服务器IP: <%=request.getServerName()%><br/>
请求服务器端口: <%=request.getServerPort()%><br/>
客服端IP地址: <%=request.getRemoteAddr()%><br/>
客户端的主机名: <%=request.getRemoteHost()%><br/>
<%=request.getParameter(“usename”) %><br/>
</body>
</html>