title: Cannot cast from Object to boolean
body: <p><strong>This is the error I am receiving,</strong></p>
  
  <pre><code>org.apache.jasper.JasperException: Unable to compile class for JSP: 
  
      An error occurred at line: 13 in the jsp file: /index.jsp
      Cannot cast from Object to boolean
  </code></pre>
  
  <p>This is my code:</p>
  
  <p><strong>Controller Servlet</strong></p>
  
  <pre><code>if(authentication.verifyCredentials(request.getParameter("username"), 
     request.getParameter("password")))
  {
          session.setAttribute("username", request.getParameter("username"));
          session.setAttribute("loggedIn", true);
          dispatcher.forward(request, response);   
  }
  </code></pre>
  
  <p><em>I also tried this,</em></p>
  
  <pre><code>session.setAttribute("loggedIn", new Boolean(true));
  </code></pre>
  
  <p><strong>JSP</strong></p>
  
  <pre><code>&lt;% 
      if(session.getAttribute("loggedIn") != null)
      {
          if(((boolean)session.getAttribute("loggedIn")))
          {
              response.sendRedirect("Controller"); 
          }
      }   
  %&gt;
  </code></pre>
  
  <p><em>Yes I researched and also saw the previous stackoverflow <a href="https://stackoverflow.com/questions/2206598/how-to-cast-object-to-boolean">post</a>; however I still cannot resolve my problem. 
  Please assist.</em> </p>