标签:str tis XML jsp页面 后台 jsp view div ack
1。静态变量方式:
<!--
实现select标签回显
-->
1.<select name="curStatus" value="${curStatus}">
<option value="0">-请选择-</option>
<option value="1" <c:if test="${‘1‘ eq curStatus}">selected</c:if> >男</option>
<option value="2" <c:if test="${‘2‘ eq curStatus}">selected</c:if> >女</option>
</select>
2。动态方式:两个变量都来自后台
<c:set var="schoolid" value="${pageData.SchoolId}" scope="request"/>
<select name="schoolId" id="schoolId" style="width: 95%">
<option value="0">==请选择==</option>
<c:forEach items="${organizeList}" var="var" varStatus="vs">
<option value="${var.name_code}" <c:if test="${var.name_code==schoolid}">selected</c:if> > ${var.name}</option>
</c:forEach>
</select>
说明一下:若是想2那种,实质上是比较两个对象的属性值,不能写成如下:
<select name="schoolId" id="schoolId" style="width: 95%">
<option value="0">==请选择==</option>
<c:forEach items="${organizeList}" var="var" varStatus="vs">
<option value="${var.name_code}" <c:if test="${var.name_code==pageData.SchoolId}">selected</c:if> > ${var.name}</option>
</c:forEach>
</select>
标签:str tis XML jsp页面 后台 jsp view div ack
原文地址:http://www.cnblogs.com/austinspark-jessylu/p/7895204.html