76

I'm trying to only show something based on if a string is not equal to:

<c:if test="${content.getContentType().getName() != "MCE"}">
<li><a href="#publish-history" id="publishHistoryTab">Publish History</a></li>
</c:if>

It keeps throwing the error org.apache.jasper.JasperException: /WEB-INF/jsp/content/manage.jsp(14,60) PWC6212: equal symbol expected

I've also tried not eq instead of !=

What is the valid syntax for not equal to?

Braiam
  • 1
  • 11
  • 47
  • 78
Ben
  • 60,438
  • 111
  • 314
  • 488
  • 1
    try "${not (content.getContentType().getName() eq 'MCE')}". Also pay attention to the quotation marks you are using, because the above expression is incorrect. – kpentchev Aug 27 '12 at 14:57

1 Answers1

150

Either != or ne will work, but you need to get the accessor syntax and nested quotes sorted out.

<c:if test="${content.contentType.name ne 'MCE'}">
    <%-- snip --%>
</c:if>
Matt Ball
  • 354,903
  • 100
  • 647
  • 710