原始碼:
<%@ page import="java.io.*,java.util.*" %>
<html>
<head>
<title>HTTP Header Request Exampletitle>
head>
<body>
<center>
<h2>HTTP Header Request Exampleh2>
<tablewidth="100%"border="1"align="center">
<trbgcolor="#949494">
<th>Header Nameth><th>Header Value(s)th>
tr>
<%EnumerationheaderNames = request.getHeaderNames();while(headerNames.hasMoreElements()) { StringparamName = (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>
瀏覽器裡的輸出頁面: