The following code will extract HttpServlet request content.
System.out.println("DUMP HttpServletRequest");
java.util.Enumeration parmNames = request.getParameterNames();
int index=1;
String tem, values[] ;
int temLen; // Length of the tem String array.
while (parmNames.hasMoreElements())
{
tem = (String)parmNames.nextElement();
values = request.getParameterValues(tem);
temLen = values.length;
System.out.print("[" + (index++) + "][" + tem + "][");
for (int i=0; i < temLen; i++)
{
if (i==0)
{
System.out.print(values[i]);
}
else
{
System.out.print(", " + values[i]);
}
}
System.out.println("]");
}
index=1;
System.out.println("DUMP HttpServletRequest Attribute");
java.util.Enumeration attrNames = request.getAttributeNames();
index=1;
while (attrNames.hasMoreElements())
{
tem = (String)attrNames.nextElement();
System.out.println("[" + (index++) + "][" + tem + "][" + request.getAttribute(tem).toString() + "]");
}
Friday, July 17, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment