0

Hi I'm maintaining some legacy JSP code and I need to be able to do some conditional rendering like

<c:if test="${SomeClass.staticMethod(obj.getUrl())}">
    <td> ... </td>
</c:if>

However I'm getting syntax error at position 19, encountered '(', expected '}', I think the test attribute doesn't like the fact that a function is being called in there?

How do I conditionally render some html in a JSP based on the return value of a function?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
755
  • 2,991
  • 3
  • 20
  • 34
  • [this](http://stackoverflow.com/questions/25893913/how-to-pass-java-variables-from-scriptlets-to-cwhen-expression-in-jstl) should help. – Andrew S Dec 12 '16 at 22:18
  • @AndrewS Is there a way to conditionally render without having to write to these various scopes? Or is that just a fundamental limitation of JSPs – 755 Dec 12 '16 at 23:43
  • 1
    See also http://stackoverflow.com/questions/6395621/how-to-call-a-static-method-in-jsp-el – Jozef Chocholacek Dec 13 '16 at 10:57

0 Answers0