1.情景展示

  ACCESS_ID == 'APP1039' 且 CARDTYPE == 99进入条件体,否则走另外的条件体 

2.错误用法

<   c:when test="${model.personInfo.ACCESS_ID == 'APP1039'} && ${model.personInfo.CARDTYPE == 99}">
< div >页面展示

3.正确方法

  方法一

<   c:choose >
< c:when test="${model.personInfo.ACCESS_ID == 'APP1039' && model.personInfo.CARDTYPE == 99}">
< div >页面展示1

< c:otherwise >
< div >页面展示2

  方法二

<   c:if test="${model.personInfo.ACCESS_ID == 'APP1039' && model.personInfo.CARDTYPE == 99}">
< div >页面展示1

< c:if test="${model.personInfo.ACCESS_ID != 'APP1039' || model.personInfo.CARDTYPE != 99}">
< div >页面展示2

4.小结  

核心标签库c没有 if else 的条件判断,可以使用c:when和c:otherwise代替;

使用c:when标签时,该标签体外必须声明c:choose标签;

多条件判断符号"&&"和"||",必须在"${}"内;

判断字符串是否相等,字符串需要加单引号'。

 

写在最后

  哪位大佬如若发现文章存在纰漏之处或需要补充更多内容,欢迎留言!!!


作者:Marydon