Java 是否可以在JSP中的类标记中使用来自数据库的内容?
我试图从我的数据库中获取一些东西来添加到JSP中的类中Java 是否可以在JSP中的类标记中使用来自数据库的内容?,java,spring-boot,jsp,taglib,Java,Spring Boot,Jsp,Taglib,我试图从我的数据库中获取一些东西来添加到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:
<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>
是的,您可以使用jstl
标记来实现这一点,如下所示:
<c:set var="category" value="${bill.category}"/>
<!--will print whatever is there in category-->
<div class="selection${category}">
</div>
是的,您可以使用jstl
标记来实现这一点,如下所示:
<c:set var="category" value="${bill.category}"/>
<!--will print whatever is there in category-->
<div class="selection${category}">
</div>
感谢它的工作,我知道我知道一些新的东西,我可以在我的代码中使用。感谢它的工作,我知道我知道一些新的东西,我可以在我的代码中使用。