java常用的比较方法

来源:互联网 发布:做淘宝卖什么 编辑:程序博客网 时间:2024/06/06 14:17




1.动态比较两个变量相等
<input type="radio" name="id" <c:if test="${item[0] eq param.id}">checked="checked"</c:if> value="${item[0]}">


2.动态比较两个变量不相等
<input type="radio" name="id" <c:if test="${item[0] ne param.id}">checked="checked"</c:if> value="${item[0]}">




3.三目运算符比较


<input type="radio" id="hasPlace" name="hasPlace" value="0" ${joinContractInfo.hasPlace==0?'checked="checked"':(joinContractInfo.hasPlace==null?'checked="checked"':'')}/>  有
<input type="radio" id="hasPlace" name="hasPlace" value="1" ${joinContractInfo.hasPlace==1?'checked="checked"':''}/> 无




4.动态值与定值比较
<input type="radio" name="id" <c:if test="${item[0]==‘1’}">checked="checked"</c:if> value="${item[0]}">


5.获取下拉框选择值:
<select style="width:110px" name="itemHalfParam.divisionCode" id="itemHalfParam.divisionCode" 
onchange="qryByOrg(this.options[this.options.selectedIndex].value)">
<option value="">所有</option>
<option value="440400">珠海市直</option>
</select></td>


5.比较相等(eq)和不等(ne)
<c:forEach var="opinion" items="${backMsg}">
<tr><td align=center>${opinion.handlerName}</td>
<td align=center>${opinion.receiveName}</td>
<td align=center>${opinion.content}</td>
<td align=center><fmt:formatDate value="${opinion.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td align=center>
<c:if test="${opinion.flowType eq '3'}">
驳回
</c:if>
<c:if test="${opinion.flowType ne '3'}">
审批
</c:if>
</td>
</tr>
</c:forEach>




6.全选和单个选择

0 0
原创粉丝点击