我对编写JSP/Servlet时使用的技巧感兴趣.我将开始:
我最近发现了如何在另一个标记的属性中包含一个JSP标记的输出:
<c:forEach items="${items}">
<jsp:attribute name="var">
<mytag:doesSomething/>
</jsp:attribute>
<jsp:body>
<%-- when using jsp:attribute the body must be in this tag --%>
</jsp:body>
</c:forEach>
Run Code Online (Sandbox Code Playgroud)