Hi there
Is there anyone who had the same issues I am having with chapter 3 of the Head First
Servlets &
JSP book?
Currently really struggling to compile the following JSP as per example on page 87 of the book.
<%@ page import="java.util.*"%>
<html>
<body>
<h1 align="center">Beer Recommendations JSP</h1>
<p>
<%
List styles = (List)request.getAttributes("styles");
Iterator it = styles.iterator();
while(it.hasNext()){
out.print("<br>try: " + it.next());
}
%>
</body>
</html>
It is returning the following exception, (I am pasting the root cause):
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 8 in the jsp file: /result.jsp
Generated servlet error:
The method getAttributes(
String) is undefined for the type HttpServletRequest
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
Thanks