title: can not cast object in jsp to java object
body: <p>I can not get this working and I dont know why...</p>
  
  <ul>
  <li>Inside my .jsp I want to check if the executing user has suffient rights to do so.</li>
  <li>the user object from the class user is one of the session attributes</li>
  <li>inside my .jsp file I get the Object from the session</li>
  <li>I then cast it into user</li>
  <li><p>then I can access its stored values (which is an array list)</p></li>
  <li><p>Then when I go and test my code I get the error listed below.</p></li>
  </ul>
  
  <p>Any Idea how to solve this Problem??</p>
  
  <p>user_management.jsp</p>
  
  <pre><code>&lt;% 
      User user = (User) session.getAttribute("obj_user");
      boolean test = user.oe_fac_role_right.get(2).get(0).equals(1);
      if (test) { 
  %&gt;
  - some html code will be displayed here is the user is allowed to see it
  &lt;%  }  %&gt;
  </code></pre>
  
  <p>User class</p>
  
  <pre><code>public class User {
      int user_id;
      String username;
      List&lt;List&lt;Integer&gt;&gt; oe_fac_role_right = new ArrayList&lt;List&lt;Integer&gt;&gt;(4);
  
      public User(){}
  
      ....
      ....
  }
  </code></pre>
  
  <p>Creation of User Object in login class:</p>
  
  <pre><code>User user = new User(user_id, username, user_rights);
  </code></pre>
  
  <p>Passing User Object to session:</p>
  
  <pre><code>session.setAttribute("obj_user", user);
  </code></pre>
  
  <p>Error message from Netbeans</p>
  
  <pre><code> An error occurred at line: 14 in the jsp file: /user_management.jsp
   user cannot be resolved to a type
  
   Line 14 in this case is: User user = (User) session.getAttribute("obj_user");
  </code></pre>