java - EL表达式嵌套问题,嵌套报错,希望大神帮忙看看,贴上代码
巴扎黑
巴扎黑 2017-04-18 10:52:24
0
1
449
          <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>
巴扎黑
巴扎黑

reply all(1)
迷茫

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" : ""}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!