Jsp test page

发表于:2007-07-04来源:作者:点击数: 标签:
author:DiegoYun date:2005-1-21 desc:jsp test page --% %@ page contentType=text/html; charset=GBK % %@ page import= java .util.Enumeration, java.util.Iterator, java.util.Collection, java.util.ArrayList% p table width=100% border=1 cellpaddi

author:DiegoYun
date:2005-1-21
desc:jsp test page
--%>
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.util.Enumeration,
java.util.Iterator,
java.util.Collection,
java.util.ArrayList"%>
<p>
<table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr>
<td width="20%" bgcolor="#CCCCCC">Request URI</td>
<%
//get Request URI and put it in a string
String requestUri = request.getRequestURI();
%>
<td bgcolor="#33CCFF"><%=requestUri%></td>
</tr>
</table>
<br>
<table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr bgcolor="#0099FF">
<td colspan="2">Request Parameter</td>
</tr>
<tr>
<td width="20%" bgcolor="#CCCCCC">Parameter Name</td>
<td bgcolor="#33CCFF">Parameter Value</td>
</tr>
<%
Enumeration enParaNames = request.getParameterNames();
String sParaName = "" ;
String sParaValue = "" ;
while(enParaNames.hasMoreElements())
{
sParaName = (String)enParaNames.nextElement();
%>
<tr>
<td bgcolor="#CCCCCC"><%=sParaName%></td>
<%
String[] sParaValues;
sParaValues = request.getParameterValues(sParaName);
int i;
for(i = 0;i<sParaValues.length;i++)
{
if (i == 0)
{
sParaValue = sParaValues[i];
}
else
{
sParaValue = sParaValue + "," + sParaValues[i];
}
}
if (sParaValue.length() == 0)
{
sParaValue = "&nbsp;";
}
%>
<td bgcolor="#33CCFF"><%=sParaValue%></td>
</tr>
<%}%>
</table>
<br>
<table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr bgcolor="#0099FF">
<td colspan="2">Request Attribute</td>
</tr>
<tr>
<td width="20%" bgcolor="#CCCCCC">Attribute Name</td>
<td bordercolor="#000000" bgcolor="#33CCFF">Attribute Value</td>
</tr>
<%
Enumeration enAttrNames = request.getAttributeNames();
String sAttrName = "" ;
String sAttrValue = "" ;
while(enAttrNames.hasMoreElements())
{
sAttrName = (String)enAttrNames.nextElement();
%>
<tr>
<td bgcolor="#CCCCCC"><%=sAttrName%></td>
<%
Object objX = request.getAttribute(sAttrName);
if (objX instanceof String)
{
sAttrValue = (String)objX;
}
else
{
sAttrValue = objX.toString();
}

if (sAttrValue.length() == 0)
{
sAttrValue = "&nbsp;";
}

%>
<td bgcolor="#33CCFF"><%=sAttrValue%></td>
</tr>
<%}%>
</table>
<br>
<table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr bgcolor="#0099FF">
<td colspan="2">Session Attribute</td>
</tr>
<tr>
<td width="20%" bgcolor="#CCCCCC">Attribute Name</td>
<td bgcolor="#33CCFF">Attribute Value</td>
</tr>
<%
Enumeration enSesNames = session.getAttributeNames();
String sSesName = "" ;
String sSesValue = "" ;
while(enSesNames.hasMoreElements())
{
sSesName = (String)enSesNames.nextElement();
%>
<tr>
<td width="20%" bgcolor="#CCCCCC"><%=sSesName%></td>
<%
Object o = session.getAttribute(sSesName);
if (o instanceof String)
{
sSesValue = (String)o;
}
else
{
sSesValue = o.toString();
}

if (sSesValue.length() == 0)
{
sSesValue = "&nbsp;";
}

%>
<td bgcolor="#33CCFF"><%=sSesValue%></td>
</tr>
<%}%>
</table>
</p>








作者Blog:http://blog.csdn.net/WalkingWithJava/

原文转自:http://www.ltesting.net