Reputation: 33
I need cast an Object to Arraylist:
<% Arraylist<Products> mypr = sesion.getAttribute("products"); %>
<table class="table table-condensed">
<tr>
<th>Id</th>
<th>Category</th>
<th>Model</th>
<th>Stock</th>
<th>Price</th>
</tr>
<%
for (Products xx : mypr) {
out.println(xx.toString() + "<br>");
}
%>
Upvotes: 1
Views: 4238
Reputation: 201537
Assuming it's an ArrayList
, you could cast it (I'd recommend the List
interface like)
List<Products> mypr = (List<Products>) sesion.getAttribute("products");
Upvotes: 2