JSP test Page
Last Update:2017-02-28
Source: Internet
Author: 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>
Author blog:http://blog.csdn.net/walkingwithjava/