-2

Below is my code snippet I am using scriplets with taglibs.

 <display:column title="Modify">
        <%String userType=(String)session.getAttribute("userType");
        if(userType.equalsIgnoreCase("D"))
        {
        %>

     <html:link action="/deleteOwner.do?type=del&owner_id=${data.owner_id}">Delete</html:link> 

     <%} else if(userType.equalsIgnoreCase("A")){%>

        <c:if test="${data.type == 'A'}">  

     <html:link action="/deleteOwner.do?type=del&owner_id=${data.owner_id}">Delete</html:link> 
        </c:if>
                </display:column>

        <%}%>

But I am getting

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 280 in the generated java file
Syntax error, insert "while ( Expression ) ;" to complete DoStatement
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
happy
  • 2,550
  • 17
  • 64
  • 109

1 Answers1

1

Try not to mix scriptlets with jstl. It will only cause you headaches. Instead replace your if/else statements with choose/when/otherwise statements.

In the case of your equalsIgnoreCase() statements, you could simply call fn:toUpperCase on your userType to do the comparison.

Using EL you can pull the userType argument using ${userType}

Sean
  • 7,597
  • 1
  • 24
  • 26