结合 JSTL var 和 Java 方法
Combinate JSTL var with Java method
如何在 java 函数中使用来自 Jstl foreach 的 Jstl 属性 ${theDetail.id}?我已经尝试了很多,但没有任何效果。
<c:forEach items="<%= facade.getAllDetails() %>" var="theDetail">
// how to use ${theDetail.id} inside this java function
<c:forEach items="<%= facade.getSomeStuffById(...) %>" vars="theStuff">
${theStuf.name}
</c:forEach>
</c:forEach>
切勿在 JSP 标签内使用 scriptlet 表达式。事实上,根本不要使用 scriptlet。 JSP 标签旨在使用 JSP EL 表达式。不是 scriptlet 表达式。
编写代码的方法是,假设 facade
是某个范围的属性
<c:forEach items="${facade.allDetails}" var="theDetail">
<c:forEach items="${facade.getSomeStuffById('someHardCodedId')}" var="theStuff">
${theStuff.name}
</c:forEach>
</c:forEach>
如何在 java 函数中使用来自 Jstl foreach 的 Jstl 属性 ${theDetail.id}?我已经尝试了很多,但没有任何效果。
<c:forEach items="<%= facade.getAllDetails() %>" var="theDetail">
// how to use ${theDetail.id} inside this java function
<c:forEach items="<%= facade.getSomeStuffById(...) %>" vars="theStuff">
${theStuf.name}
</c:forEach>
</c:forEach>
切勿在 JSP 标签内使用 scriptlet 表达式。事实上,根本不要使用 scriptlet。 JSP 标签旨在使用 JSP EL 表达式。不是 scriptlet 表达式。
编写代码的方法是,假设 facade
是某个范围的属性
<c:forEach items="${facade.allDetails}" var="theDetail">
<c:forEach items="${facade.getSomeStuffById('someHardCodedId')}" var="theStuff">
${theStuff.name}
</c:forEach>
</c:forEach>