JSP中 select下拉项如何判断选中
1个回答
展开全部
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> 12345678
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>
<!--
实现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> 12345678
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>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询