使用jsp打印HTTP请求头部所有字段的值

<%@ page import="java.io.*,java.util.*" %>
<html>
<head>
<title>HTTP Header Request Example</title>
</head>
<body>
<center>
<h2>HTTP Header Request Example</h2>
<table width="100%" border="1" align="center">
<tr bgcolor="#949494">
<th>Header Name</th><th>Header Value(s)</th>
</tr>
<%    Enumeration headerNames = request.getHeaderNames();    while(headerNames.hasMoreElements()) {       String paramName = (String)headerNames.nextElement();       out.print("<tr><td>" + paramName + "</td>\n");
      String paramValue = request.getHeader(paramName);
      out.println("<td> " + paramValue + "</td></tr>\n");
   }
%>
</table>
</center>
</body>
</html>

浏览器里的输出页面:

使用jsp打印HTTP请求头部所有字段的值

上一篇:如何在JSP里使用Java Bean


下一篇:Microsoft Dynamics CRM 2013 /2015 配置之 添加 CRM 帐号和新建邮箱