读书人

求指教解决思路

发布时间: 2013-10-21 17:00:48 作者: rapoo

求指教
有如下条件:
1、op的值为‘m’且${ fn:split(product.smallpic, '|')[0] }不为null 则显示图片
2、op的值为‘m’ 但${ fn:split(product.smallpic, '|')[0] eq null }则显示“暂无图片”

<c:choose>
<c:when test="${ param.op eq 'm' }">
<c:when test="${ fn:split(product.smallpic, '|')[0] eq null }">暂无图片</c:when>
<c:otherwise>
<img id="product${ product.tp_id }" src="${ pageContext.request.contextPath }/${ fn:split(product.smallpic, '|')[0] }" width="60" height="60" />
</c:otherwise>
</c:when>
</c:choose>

这么写不对 我该怎么写 在线等 求帮帮忙
[解决办法]

<c:choose>
<c:when test="${ param.op eq 'm' }">
<c:when test="${empty fn:split(product.smallpic, '
[解决办法]
')[0] }">暂无图片</c:when>
<c:otherwise>
<img id="product${ product.tp_id }" src="${ pageContext.request.contextPath }/${ fn:split(product.smallpic, '
[解决办法]
')[0] }" width="60" height="60" />
</c:otherwise>
</c:when>
</c:choose>

[解决办法]
empty fn:split(product.smallpic, '
[解决办法]
')[0] 或者 eq "" 试下
[解决办法]
eq null这是和null比较,用empty。
[解决办法]

确保你param.op这样能取到值。


<c:when test="${ param.op eq m }">


<c:when test="${ empty fn:split(product.smallpic, '
[解决办法]
')[0]}">暂无图片</c:when>
<c:otherwise>
<img id="product${ product.tp_id }" src="${ pageContext.request.contextPath }/${ fn:split(product.smallpic, '
[解决办法]
')[0] }" width="60" height="60" />
</c:otherwise>
</c:when>


[解决办法]
<c:if test="${param.op eq 'm' && empty fn:split(product.smallpic, '
[解决办法]
')[0]}"></c:if>
<c:if test="${param.op eq 'm' && !empty fn:split(product.smallpic, '
[解决办法]
')[0]}"></c:if>
[解决办法]
empty ++

读书人网 >Java Web开发

热点推荐