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

Antworte allen(1)
迷茫

首先,el表达式里不应该再嵌套el表达式,比如${chapter.chapterType==${cType.id}},至少应该写成${chapter.chapterType==cType.id}吧。

其次,我也不是太了解jsp编译的原理,比如xml的tag里再嵌tag会不会有问题。如果非要在tag里做判断,不妨用el表达式取代<c:if>,比如:${chapter.chapterType==cType.id ? " selected=selected" : ""}

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!