sr1
sr1

Reputation: 251

Error: 'else' without 'if' in JSP

When i'm trying to execute this code, i'm getting this error : 'else' without 'if' .. .... Unable to figure out the error !

<% for(int i =1; i<=10 ; i++) {  %>

    <tr>

     <% for(int j=1; j<=10 ; j++) {   %>

        <%  for(int k=0 ; k< un.size() ; k++)  {  

            xax = cp.get(k)/10;
            yax = cp.get(k)%10;
            co = col.get(k)+".jpg";
        %>


        <%   if(xax==i && yax ==j) { %>   <td> <img src=<%=co%> id="pawn">  </td> <%  j++;} %> 

        <%   else { %> <td>  </td>  <% j++; }  %>


     <% } %>
     <% } %>



        </tr>

   <% } %>

Upvotes: 2

Views: 376

Answers (1)

Ranjitsinh
Ranjitsinh

Reputation: 1349

Please try this.

  <%   if(xax==i && yax ==j) { %> 
  <td> <img src=<%=co%> id="pawn">  </td> 
<%  j++;}  else { %> 
<td>  </td> 


 <% j++; }  %>

Hope it will help.!!

Upvotes: 1

Related Questions