请求头信息

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ page import="java.util.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="bean" uri="/WEB-INF/struts-bean.tld" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'headerTest.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>
	<h2>bean标签header测试</h2>
	<%
		//获取所有的请求头
		java.util.Enumeration names = 
			((HttpServletRequest)request).getHeaderNames();
	%>
	<table border="1">
		<tr>
			<th>Header Name</th>
			<th>Header Value</th>		
		</tr>
		<%
			//遍历请求头,获取请求头的名字,根据请求头名依次输出每个头对应的值
			while(names.hasMoreElements()){
				String name = (String)names.nextElement();
		
		%>
			<bean:header id="item" name="<%=name%>"/>
			<tr>
				<td>
					<%=name %>
				</td>
				<td>
					${item }
				</td>
			</tr>
		<%
			}
		%>
	</table>
  </body>
</html>

 

你可能感兴趣的:(bean,jsp,css,cache,struts)