<p class="col-xs-2">
<select id="chapterType" name="chapterType" class="form-control" >
<c:forEach items="${chapterType}" var="cType" >
<option value="${cType.id}"
<c:if test="${chapter.chapterType==${cType.id}}">selected = selected</c:if>>
${cType.name}
</option>
</c:forEach>
</select>
</p>
迷茫2017-04-18 10:54:24
First of all, el expressions should not be nested inside el expressions, such as ${chapter.chapterType==${cType.id}}
,至少应该写成${chapter.chapterType==cType.id}
.
Secondly, I don’t know much about the principles of jsp compilation. For example, will there be any problem if the tag is embedded in the xml tag? If you have to make a judgment in the tag, you might as well use el expression instead<c:if>
,比如:${chapter.chapterType==cType.id ? " selected=selected" : ""}