Java – conditional rendering of HTML in spring MVC
•
Java
Are there any tags that can conditionally render HTML blocks For example, struts has:
<logic:present name="someForm" property="someProperty"> //Code block </logic:present>
For example, JSF has:
<h:panelGrid rendered="#{not empty someList}"> //Some code block </h:panelGrid>
Is there anything similar in spring MVC?
Solution
Simple old JSTL gives you rescue!
The advantage of spring MVC is that it does not add a large number of redundant tag libraries like other frameworks You can always rely on JSTL for such checks, which are now part of the JSP specification
<c:if test="${not empty someList}"> </c:if>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码