Reputation: 4199
I want to print the elements from an array , using foreach loop it is giving error "The prefix j for element j:foreach is not bound".
Below is the code which I wrote:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<h1>Jello World </h1>
<g:evaluate>
var words=['Hello','world','bye'];
</g:evaluate>
<j:foreach var="jvar_word" items="${words}">
<p> ${jvar_word} </p>
</j:foreach>
</j:jelly>
Upvotes: 4
Views: 444
Reputation: 16245
I believe Jelly is case sensitive. Try changing j:foreach
to f:forEach
.
<j:forEach var="jvar_word" items="${words}">
<p> ${jvar_word} </p>
</j:forEach>
Upvotes: 2