? if((myFlag == true) && (flag1 != null || flag2 != null || flag3 != null))" />
开发者

How to code this if structure in JSTL?

开发者 https://www.devze.com 2023-03-30 09:09 出处:网络
can we code the following if condi开发者_StackOverflowtion inside the <c:if test=\"${}> ? if((myFlag == true) && (flag1 != null || flag2 != null || flag3 != null))

can we code the following if condi开发者_StackOverflowtion inside the <c:if test="${}> ?

if((myFlag == true) && (flag1 != null || flag2 != null || flag3 != null))


Sure:

<c:if test="${myFlag and (not empty flag1 or not empty flag2 or not empty flag3)}">

PS: Using a null-test to decide a flag instead of true/false is bad style and should be avoided, if possible.


<c:if test="${myFlag && (flag1 != null || flag2 != null || flag3 != null)}">

Simple, isn't it?

See http://java.sun.com/products/jsp/syntax/2.0/syntaxref207.html#1010522 for a reference

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号