Question: i receive an Arraylist from my servlet.
here is the code of my JSP page

```
<%
String bgcolor="";
int count=0;
List  viewList = new ArrayList();
Iterator  viewItr;
Iterator itr;
if(request.getAttribute("userList")!=null && request.getAttribute("userList")!="")
{
    List<Zone> userList =  (List<Zone>)request.getAttribute("userList");
     itr = userList.iterator();
    while(itr.hasNext())
    {

        if(count%2==0)
        {
         bgcolor = "#C8E2D1";
        }
        else
        {

            bgcolor = "#EAF8EF";
        }

        viewList = (ArrayList)itr.next();
        int id = Integer.parseInt(viewList.get(0).toString());

        viewItr = viewList.iterator();
        %>

        <tr style="background-color:<%=bgcolor%>;">
        <%  
        while(viewItr.hasNext())
        {

            %>
            <td><%=viewItr.next()%></td>

            <%

        }
        count++;
        %>

```

I got an error, it says that bean.Zone cannot be cast to arraylist,
the error is at line `**viewList = (ArrayList)itr.next();**`
Thank you for your help

Answer: 
I think you have a **Zone** object, **not an Arraylist**. That's why you can't cast. 

You are already iterating the Zone list, and you need to cast to a **Zone object**.

```
Zone viewList = new Zone();

viewList = (Zone)itr.next();

```
There are couple of things wrong here.

* `request.getAttribute("userList")!=""` is wrong in `if`. You should not compare List with empty string.
* You are iterating over `List<Zone>`s so when you call itr.next() you will get a `Zone` not a ArrayList.

So your second `while` is invalid here. You may need to get and display the attributes from `Zone`.