问题
How can I create a dynamic id of li tag using the foodInfo which is set to c:set
?
<c:forEach var="food" varStatus="i" items="${selectedIngredientsList}">
<c:set var="foodInfo" value="${food.foodItemId}~${food.foodCategoryId}~${food.foodName}~${food.foodPortionName}"/>
<ul>
<li id="??"><c:out value="${food.foodName}"/>
</li>
</ul>
</c:forEach>
回答1:
I used like below to assign dynamic id with the prefix that I want to use.
<li id="my_${foodInfo}">
来源:https://stackoverflow.com/questions/15017817/dynamic-id-for-li-tag