Jsp test page

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

<%--

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>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航