I'm using HttpSession to store ArrayList userList as session attribute from original Servlet before passing it to JSP. It is then called in the next JSP and then called to another Servlet from that JSP.
Servlet 1 -> JSP1 -> JSP2 -> Servlet 2
In Servlet 1, I've set it to session :
if (!userList.isEmpty()) {
session.setAttribute("userList", userList);
}
I iterate it in JSP 1 and JSP 2 and call it again in Servlet 2. I need the ArrayList to be used as a parameter in another method in servlet 2.
EditStudentForm edt = (EditStudentForm)form;
List<UserApplication> studtList = new ArrayList<UserApplication>();
if ((session.getAttribute("userList")) instanceof List){
studtList = (ArrayList<UserApplication>)request.getSession().getAttribute("userList");
}
try {
uaDAO.editUser(edt,studtList);
action_forward = EDITSUCCESS;
}
It looks like the casting is not really working because the size of the ArrayList is 1 (I'm expecting a size of at least 30)
What am I doing wrong?
ArrayListif you're checking for aList--cast toList. - Dave Newton