使用 if JSTL 调用 javascript 函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27925219/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 08:10:32 来源:igfitidea点击:
Call javascript function with if JSTL
提问by David
Is there a way to call a javascript function inside an if with JSTL?
有没有办法在带有 JSTL 的 if 中调用 javascript 函数?
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>
回答by Alexander T.
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>