【JSTL】<c:if test=“”>没有else的解决方法
2017-04-06 17:41
429 查看
后台封装了一个对象 放在model里:
notice是个对象
然后前台如果没有公告的话,希望显示暂无公告:
前台<c:if>没有else的逻辑,怎么解决?
解决方案:
如此,有公告的时候,就显示,没有就是暂无公告:
model.addAttribute("notice", notice);
notice是个对象
然后前台如果没有公告的话,希望显示暂无公告:
前台<c:if>没有else的逻辑,怎么解决?
解决方案:
<div class="panel-body"> <c:choose> <c:when test="${notice != null}"> <h2 style = "text-align: center;">${notice.noticeName}</h2> <h4 style = "text-align: center;">公布人:${notice.noticeCre}</h4> <h4 style = "text-align: center;">公布日期:${noticeTime}</h4> <br> <div style = "text-align: center;"> ${notice.noticeContent} </div> </c:when> <c:otherwise> <h2 style = "text-align: center;">暂无公告</h2> </c:otherwise> </c:choose> </div>
如此,有公告的时候,就显示,没有就是暂无公告:
相关文章推荐
- JSTL 的<c:if>标签没有else的解决办法
- jstl 的<c:if>标签没有else的解决办法
- jstl 的<c:if>标签没有else的解决办法
- jstl 的if else <c:choose><c:when test="">如果</c:when><c:otherwise>否则</c:otherwise></c:choose>
- 关于<c:if>没有<c:else>解决方案
- <c:if>没有<c:else>解决办法
- 如何在JSP页面中使用JSTL标签实现if和if-else判断,判断条件使用<%=value%>
- <c:if>没有<c:else>解决办法
- JSTL中解决c:if没有else
- Myeclipse运行程序时出现Console没有输出信息(只有<terminate>...)解决方法
- IEnumber<Model.Category> 实现接口对象没有Add()方法解决问题
- 关于<:if>没有<c:else> 可以用<c:choose>来取代结构:
- JSTL中<c:if test="${value=='0'} ">错误问题!
- struts2中JSP无法用<jsp:forward page="test.action"> 跳转到对应的 action中解决方法
- Myeclipse运行程序时出现Console没有输出信息(只有<terminate>...)解决方法
- <s:if test="canSubscribe == 'Y'">能 </s:if> <s:else>不能 </s:else> 单字符需加.toString()
- 关于<c:if>没有<c:else>解决方案
- <s:if test="canSubscribe == 'Y'">能 </s:if> <s:else>不能 </s:else> 单字符需加.toString()
- 10027---关于<:if>没有<c:else>解决方案
- 关于<:if>没有<c:else>解决方案