想实现这样的功能:
当用户头像为空的时候,不显示加关注,当用户头像不为空并且为关注的时候,显示添加关注!目前是这种情况,当用户头像为空的时候,会显示添加关注。
<div class="userPhoto">
<a href="#" namecard="true" uid="${user.uid}">
<c:choose>
<c:when test="${empty user.mugshot256}">
<img alt="" src="${RESOUCE_STATIC_URL}/images/avatar_64_64.png">
</c:when>
<c:otherwise>
<img alt="" src="${RESOUCE_UPLOAD_URL}/${user.mugshot256}">
<c:choose>
<c:when test="${user.beenFollowed}">
<c:set var = "styleFollow" value="display:none" />
</c:when>
<c:otherwise>
<c:set var = "styleFollow" value="" />
</c:otherwise>
</c:choose>
<a class="follow-action blue-button-addnew" title="加关注" style="${styleFollow}" uid="${user.uid}" ><span class="addnew">+</span></a>
</c:otherwise>
</c:choose>
</a>
</div>本人对jstl不是很熟悉,望大家指点!
当用户头像为空的时候,不显示加关注,当用户头像不为空并且为关注的时候,显示添加关注!目前是这种情况,当用户头像为空的时候,会显示添加关注。
<div class="userPhoto">
<a href="#" namecard="true" uid="${user.uid}">
<c:choose>
<c:when test="${empty user.mugshot256}">
<img alt="" src="${RESOUCE_STATIC_URL}/images/avatar_64_64.png">
</c:when>
<c:otherwise>
<img alt="" src="${RESOUCE_UPLOAD_URL}/${user.mugshot256}">
<c:choose>
<c:when test="${user.beenFollowed}">
<c:set var = "styleFollow" value="display:none" />
</c:when>
<c:otherwise>
<c:set var = "styleFollow" value="" />
</c:otherwise>
</c:choose>
<a class="follow-action blue-button-addnew" title="加关注" style="${styleFollow}" uid="${user.uid}" ><span class="addnew">+</span></a>
</c:otherwise>
</c:choose>
</a>
</div>本人对jstl不是很熟悉,望大家指点!
<img alt="" src="${RESOUCE_STATIC_URL}/images/avatar_64_64.png">
</c:when>
或者
<c:when test="${user.mugshot256 eq ""}">
<img alt="" src="${RESOUCE_STATIC_URL}/images/avatar_64_64.png">
</c:when>
<a href="#" namecard="true" uid="${user.uid}">
<c:choose>
<c:when test="${empty user.mugshot256}">
<img alt="" src="${RESOUCE_STATIC_URL}/images/avatar_64_64.png">
</c:when>
<c:otherwise>
<img alt="" src="${RESOUCE_UPLOAD_URL}/${user.mugshot256}">
<c:if test="!${user.beenFollowed}">
<a class="follow-action blue-button-addnew" title="加关注" style="${styleFollow}" uid="${user.uid}" ><span class="addnew">+</span></a>
</c:if>
</c:otherwise>
</c:choose>
</a>
</div>