我对 JSTL 和 Java 很陌生。有没有更好的方法来格式化这个 for 循环,似乎我可以把它再分解一点,让它更干净。理想情况下,我不想逃避字符串,但不确定如何或是否有更好的方法?我知道在 JSTL 中声明变量时,您可以使用 c: 标记内的属性执行如下操作。你可以用 for 循环做类似的事情吗?
<c:set var="childNode"><%= properties.get("childrenNode", "") %></c:set>
<c:forEach items="<%=childResults.getPath((Child)pageContext.getAttribute(\"childPage\"), currentPage, new showChildrenFilter())%>" var="segment" varStatus="status">
${displaySomething}
</c:forEach>
任何帮助是极大的赞赏!