title: Why is the Java code in JSP generating an error?
body: <p>I'm trying to input some java code in my jsp however the following exception is being generated : </p>
  
  <pre><code>org.apache.jasper.JasperException: /Home.jsp(31,8) PWC6203: Scripting elements ( &amp;lt;%!, &amp;lt;jsp:declaration, &amp;lt;%=, &amp;lt;jsp:expression, &amp;lt;%, &amp;lt;jsp:scriptlet ) are disallowed
  </code></pre>
  
  <p>My jsp contains an if statement and will check data. If it matches, some html code is displayed, otherwise, another code is displayed</p>
  
  <pre><code>&lt;% String username = session.getAttribute("loggedIn").toString();
                 String actual = "${message.message}";
                 if(username.equals(actual)){%&gt;
                  &lt;div style="background-color:#fff380;"&gt; 
                  ...
                  &lt;/div&gt;
              &lt;%} else { %&gt;
                  &lt;div&gt; 
                  ...
                  &lt;/div&gt;
              &lt;%}%&gt;
  </code></pre>
  
  <p>Does anyone know why this type of error is being generated please? thanks a lot</p>