I'm trying to pass a arrayList from servlet to jsp.
This is code from servlet
ArrayList<User> users = UserCollection.getInstance().getArray();
HttpSession session=request.getSession();
session.setAttribute("list", users);
response.sendRedirect("ListProfils.jsp");
This is code in jsp
<center>
<table style="width:60%" id="t01">
<tr background-color: #012e5e;>
<th>Email</th>
<th>Phone Number</th>
<th>City</th>
<th>Address</th>
</tr>
<%@page import="java.util.ArrayList"%>
<%
ArrayList<User> val=(ArrayList)request.getSession().getAttribute("list");
for (User user : val) { %>
<tr>
<td><%out.println(user.getEmail());%></td>
<td><%out.println(user.getPhoneNumber());%></td>
<td><%out.println(user.getCity());%></td>
<td><%out.println(user.getAddress());%></td>
</tr>
<% }
%>
</table>
</center>
But when i try to run code Ρhe following error is displayed
An error occurred at line: [37] in the jsp file: [/ListProfils.jsp]
User cannot be resolved to a type
34: <%@page import="java.util.ArrayList"%>
35:
36: <%
37: ArrayList<User> val=(ArrayList)request.getSession().getAttribute("list");
38:
39: for (User user : val) { %>
40: <tr>
An error occurred at line: [39] in the jsp file: [/ListProfils.jsp]
User cannot be resolved to a type
36: <%
37: ArrayList<User> val=(ArrayList)request.getSession().getAttribute("list");
38:
39: for (User user : val) { %>
40: <tr>
41: <td><%out.println(user.getEmail());%></td>
42: <td><%out.println(user.getPhoneNumber());%></td>
I read in google for this bug, and I had to import my class User. But he is in a default package and i dont know how to import him. Please help me