首页 > 其他分享 >jsp技术之“如何在jsp中判断属性为空”

jsp技术之“如何在jsp中判断属性为空”

时间:2023-01-10 17:14:30浏览次数:30  
标签:判断 代码 feature jsp 为空 属性

一、判断对象列表为空不显示某段代码

<%-- 展开子属性 --%>
<c:if test="${not empty product.variations}">
    <div style="position: absolute; bottom: 0; margin-bottom: 5px;">
        <button type="button" class="btn default" onclick="expandVariations(this, '${product.productSku}')">
            <i class="icon-minus"></i>
        </button>
    </div>
</c:if>

 

二、判断字段是否为true,来决定显不显示代码

<c:if test="${product.productExtend.isAutoPublish}">
    <div>
        <span class="label custom label-success">自动刊登</span>
    </div>
</c:if>

 

 

三、判断如果是执行某些代码,否则显示某些代码

<c:choose>
    <%-- 仓库专用标签 --%>
    <c:when test="${product.feature == '重量差异' }">
        <c:if test="${app:auth('11104200') }">
            <span id="product-label-${product.productId }-${feature }"><span class="label label-danger label-sm">${feature }</span></span><br>
        </c:if>
    </c:when>
    <c:when test="${feature == '7天+缺货未发' && isExistAmazonPlatform && department.departmentType == 1}"></c:when>
    <c:otherwise>
        <span id="product-label-${product.productId }-${feature }"><span class="label label-danger label-sm">${feature }</span></span><br>
    </c:otherwise>
</c:choose>

 

标签:判断,代码,feature,jsp,为空,属性
From: https://www.cnblogs.com/saoge/p/17040785.html

相关文章

  • div背面隐藏属性
    我们知道div这个dom元素视图是可分为:正面与背面——两个视觉面的。一般我们只关注正面视觉展示,但如果加上一些翻转效果时,背面展示可能会影响整体视觉效果。这个时候我......
  • spring事务的传播属性--@Transaction的Propagation属性
    在Spring的@Transaction中,有个重要的属性:Propagation,指的是事务方法之间发生嵌套调用时,事务的传播行为(当前调用的这个方法的事务,和当前的其他事务之间的关系)。在Transaction......
  • ElementUI 全局设置组件的原生默认属性
    propsimportElementUIfrom'element-ui'Element.Input.props.clearable.default=true;原生属性通常情况下,以maxlength属性为例importElementUIfrom'element......
  • @ComponentScan详解&@SpringBootApplication的scanBasePackages属性
    一、@ComponentScan源码@Retention(RetentionPolicy.RUNTIME)@Target({ElementType.TYPE})@Documented@Repeatable(ComponentScans.class)public@interfaceComponen......
  • go.Binding 如何根据多个属性进行绑定
    1、通常我们这么用    newgo.Binding('source','category_id',function(n){       leta=imgDit[n];       returna; ......
  • QML ListView几个常用且非常重要的属性
    importQtQuick.Window2.2importQtQuick.Controls2.2Window{visible:truetitle:qsTr("HelloWorld")ListView{id:listViewanchors.fill:......
  • MSBuild属性
    MSBuild属性MSBuild属性是键值对的集合,提前生命好这些属性之后,整个项目的生成都可以引用这些属性1、声明属性:声明一个属性BuildDir,属性值为:Build点击查看代码<Prop......
  • JSP
    JSP1. 定义JSP全称JavaServerPages,是一种动态网页开发技术。它使用JSP标签在HTML网页中插入Java代码。标签通常以<%开头以%>结束。JSP是一种Javaservlet,主要用于实......
  • 浏览器访问 JSP 文件时无法进入 JavaScript 代码
    问题描述浏览器访问<head>中有JavaScript代码的JSP文件:<%@pagecontentType="text/html;charset=UTF-8"language="java"%><html><head><title>$Title......
  • 关于MyBatis查询属性封装到对象,对象为null的情况源码分析
    源码分析在DefaultResultSetHandler类中getRowValue方法创建映射类相应的对象,如果为列匹配到的值标识foundValues是false,表示没有为对象中任何一个字段映射到一个值,则......