Hi teks,
I am having a problem with using 'Enumeration" method in the below JSP: I am trying to print HEADERS in a table format.
Please help,
preethib
------------
//GETHEADERS.jsp
------------
<html>
...
<%!
static class RequestHeader extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
PrintWriter out = response.getWriter();
out.println("<table border=0>"
Enumeration e = request.getHeaderNames();
while (e.hasMoreElements()) {
String headerName = (String)e.nextElement();
String headerValue = request.getHeader(headerName);
out.println("<tr><td bgcolor=\"#CCCCCC\">" + headerName);
out.println("</td><td>" + headerValue + "</td></tr>"
}
out.println("</table>"
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doGet(request, response);
}
}
%>
<h3> HTTP Headers </h3>
<%
RequestHeader jpe = new RequestHeader();
jpe.doGet(request, response);
%>
..
</html>
------------
On compile I get:
------------
Error: 500
Location: /lab04/p4a.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-3.2.3\work\localhost_8080%2Flab04\_0002fp_00034a_0002ejspp4a_jsp_0.java:29: Class Enumeration not found.
Enumeration e = request.getHeaderNames();
^
1 error
--------------
I am having a problem with using 'Enumeration" method in the below JSP: I am trying to print HEADERS in a table format.
Please help,
preethib
------------
//GETHEADERS.jsp
------------
<html>
...
<%!
static class RequestHeader extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
PrintWriter out = response.getWriter();
out.println("<table border=0>"
Enumeration e = request.getHeaderNames();
while (e.hasMoreElements()) {
String headerName = (String)e.nextElement();
String headerValue = request.getHeader(headerName);
out.println("<tr><td bgcolor=\"#CCCCCC\">" + headerName);
out.println("</td><td>" + headerValue + "</td></tr>"
}
out.println("</table>"
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doGet(request, response);
}
}
%>
<h3> HTTP Headers </h3>
<%
RequestHeader jpe = new RequestHeader();
jpe.doGet(request, response);
%>
..
</html>
------------
On compile I get:
------------
Error: 500
Location: /lab04/p4a.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-3.2.3\work\localhost_8080%2Flab04\_0002fp_00034a_0002ejspp4a_jsp_0.java:29: Class Enumeration not found.
Enumeration e = request.getHeaderNames();
^
1 error
--------------