Jsp test page

來源:互聯網
上載者:User
js <%--
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 = " ";
}
%>
<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 = " ";
}

%>
<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 = " ";
}

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








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


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.