Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enumeration method in JSP

Status
Not open for further replies.

preethib

Programmer
Jul 20, 2000
39
IN
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(&quot;<table border=0>&quot;);
Enumeration e = request.getHeaderNames();
while (e.hasMoreElements()) {
String headerName = (String)e.nextElement();
String headerValue = request.getHeader(headerName);
out.println(&quot;<tr><td bgcolor=\&quot;#CCCCCC\&quot;>&quot; + headerName);
out.println(&quot;</td><td>&quot; + headerValue + &quot;</td></tr>&quot;);
}
out.println(&quot;</table>&quot;);

}


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

--------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top