Im trying to get something out of my database to add to a class in my JSP.
<div class="selection <c:out value='${bill.category}'/>">
<c:forEach items="${bills}" var="bill">
<div class="selection <c:out value='${bill.category}'/>">
<p><c:out value="${bill.name}"/></p>
<div class="plus-icon">
<ion-icon size="large" name="add-circle-outline</ion-icon
</div>
</div>
</c:forEach>
答案 0 :(得分:0)
是的,您可以使用jstl
标签,如下所示:
<c:set var="category" value="${bill.category}"/>
然后像下面这样在div
中使用上面的内容:
<!--will print whatever is there in category-->
<div class="selection${category}">
</div>