有没有办法在使用JSTL的if中调用javascript函数?
这是代码
<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>
答案 0 :(得分:10)
试试这个
<c:choose>
<c:when test="${orderUploadAction.errors.size()==0}">
<script> yourFunctionName() </script>
</c:when>
<c:otherwise>
<script> yourAnotherFunctionName() </script>
</c:otherwise>
</c:choose>