Kiva
Kiva

Reputation: 9363

Object Request with JSP

I have a problem with a JSP file. I want to retrieve the header but I have an error:

Une erreur s'est produite à la ligne: 45 dans le fichier jsp: /logTest.jsp
Enumeration cannot be resolved to a type
42: String headerString = "";
43: String name = "";
44: 
45: for (Enumeration en = request.getHeaderNames(); en.hasMoreElements(); ) {
46:     name = (String)en.nextElement();
47:     headerString = headerString + name + "=<B>" + request.getHeader(name) + "</B><BR>";
48: }

My object (request) is not null so I don't understand why I have this error.

Can you help me ?

Thanks.

Upvotes: 2

Views: 1028

Answers (1)

Jonathan Feinberg
Jonathan Feinberg

Reputation: 45364

You have to explicitly import java.util.Enumeration. The stack trace gave you the answer: "Enumeration cannot be resolved to a type".

Upvotes: 6

Related Questions