javascript - jsp页面如何重新给传进来的值做判断

查看:109
本文介绍了javascript - jsp页面如何重新给传进来的值做判断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

图片:

详细代码:
<li class="li_2">

<h2 class=" mb5">${thematic.title }发布</h2>                        
<span class="f14 ">${thematic.documentName } ${thematic.information }</span>

</li>

问题:

 ${thematic.information }值为1,2,3 我想把   1变成"这是第一个"
                                            2变成"这是第二个"
                                            ...
 显示在页面上 

不知道应该怎么写代码,大神知道下

以解决:代码入下
<c:if test="${thematic.information == 1}">平面/互联网</c:if>
<c:if test="${thematic.information == 2}">微博</c:if>
<c:if test="${thematic.information == 3}">微信</c:if>
<c:if test="${thematic.information == 4}">电视/电台</c:if>

解决方案

<c:choose>
    <c:when test="${thematic.information eq 1}">
       这是第一个
    </c:when>
    <c:when test="${thematic.information eq 2}">
        这是第二个
    </c:when>
    <c:otherwise>
      ...
    </c:otherwise>
</c:choose>

这篇关于javascript - jsp页面如何重新给传进来的值做判断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆