Reputation: 466
How to loop and access 'somethings' variable from request scope in JSP page?
<c:set var="somethings" value="${fn:split('a,b,c', ',')}" scope="request"/>
<c:forEach items="somethings" var="some">
${some} // <= Expected show a b c, but why display 'somethings'?
</c:forEach>
Thanks.
Upvotes: 0
Views: 1450
Reputation: 3146
You see "something" because items can be an object. In your case it's a string because it's not evaluated as an object. Try:
<c:forEach items="${somethings}" var="some">
${some}
</c:forEach>
Note the $ and brackets.
Upvotes: 2