Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call javascript function with if JSTL

Is there a way to call a javascript function inside an if with JSTL?

Here's the code

<c:choose>
                <c:when test="${orderUploadAction.errors.size()==0}">

                CALL JS FUNCTION HERE

                </c:when>
                <c:otherwise>

                CALL JS FUNCTION HERE

                </c:otherwise>
</c:choose>
like image 400
David Avatar asked Jan 13 '15 15:01

David


1 Answers

Try this

<c:choose>
  <c:when test="${orderUploadAction.errors.size()==0}">
     <script> yourFunctionName() </script>
  </c:when>
  <c:otherwise>
     <script> yourAnotherFunctionName() </script>
  </c:otherwise>
</c:choose>
like image 156
Oleksandr T. Avatar answered Oct 19 '22 22:10

Oleksandr T.