Hi
I'm trying to create a very simple app to learn jsps and
servlets. I have 2 jsps and 1 servlet, along with various
java classes.
The first
jsp UserEntryJsp asks the user to input basic info like name, age for search criteria. The FORM ACTION from this jsp goes to the UserEntryServlet.
The UserEntryServlet instantiates a user, calls a getUserList method which returns an ArrayList from a MySQL database.
The UserExitJsp is supposed to display the List of users matching the search criteria. I've added tons of System.out.printlns to the servlets, jsps, etc. so I can use the console to see what is happening and not happening. My problem is when I try to retrieve the ArrayList from session and cast it to a List.
I'm using Eclipse, and the message I get is
org.apache.jasper.JasperException: Exception in JSP: /jsps/UserExitJsp.jsp:9
It indicates the line above as the problem. It lists a root cause of:
java.lang.ClassCastException
I've searched on this and other sites and found the frequent answer that the code should be something like this:
[code]
<%List<
String> l = new ArrayList<String>((ArrayList<String>

session.getAttribute("userList")); %>
[\code]
I've tried this and get an error ArrayList cannot be resolved to a type.
Thanks in advance for any help!