1

Is there any possibility to get only the first element from list in view?

 <c:forEach items="${products}" var="product">
     <h3>${product.name}</h3>
 </c:forEach>
BalusC
  • 1,040,783
  • 362
  • 3,548
  • 3,513
Jack937
  • 33
  • 1
  • 8

1 Answers1

2

When you're sure there is at least one element, you could write:

<c:set var="first" value="${products[0]}"/>
Ali Dehghani
  • 43,096
  • 14
  • 154
  • 142