servlet is not called when condtion is met in jsp
<p>I am performing add to cart in java script which should call servlet addtocart.jlc as shown below.</p>

<pre><code>&lt;%@page import = "java.util.*" %&gt;
&lt;html&gt;
&lt;body&gt;
&lt;center&gt;
&lt;h1&gt;JLC book store&lt;/h1&gt;
&lt;h2&gt;JLC book search&lt;/h2&gt;
&lt;font color = "green" size = '6'&gt; ${ADDED}&lt;/font&gt;
&lt;/center&gt;
&lt;br/&gt;
&lt;%Object obj = request.getAttribute("MSG");
  if(obj != null) { // if condtion
      %&gt;
      &lt;br/&gt; &lt;center&gt;
            &lt;font color = "red" size = "6"&gt;  
             &lt;%=obj%&gt;
            &lt;/font&gt;
            &lt;br/&gt;&lt;a href = "index.jsp"&gt; 
            &lt;h2&gt; GO TO SEARCH PAGE1 &lt;/h2&gt;&lt;/a&gt;
            &lt;/center&gt;
   &lt;%} else { // if condition end and else condition open
       obj = session.getAttribute("BOOKS");
       ArrayList&lt;String&gt; blist = (ArrayList&lt;String&gt;)obj;
       for(String bnm:blist) { 
   %&gt;
   &lt;form action="addtocart.jlc" method="post"&gt;
   &lt;input type = "hidden" name = "bname" 
     value = "&lt;%=bnm%&gt;" /&gt;
   &lt;font size = '5'&gt; &lt;%=bnm%&gt; &lt;input type = "submit" 
       value = "ADD TO CART" /&gt;
   &lt;/font&gt;
   &lt;/form&gt;
   &lt;% } %&gt; 
   &lt;form action = "showcart.jlc"&gt;
   &lt;input type = "submit" value = "SHOW CART" /&gt; 
   &lt;/form&gt;
   &lt;% } %&gt; 


&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>when I ran above program I am getting output as shown below which is in if condition. I am not getting what is error. I am new to jsp and this is print out given by my lecture. I am working on but not able to get what is bug. I am using eclipse EE and tom cat server.</p>

<p>JLC book store
JLC book search
 No books found with categorynull  </p>

<p>GO TO SEARCH PAGE1 </p>