ServiceNow: Jelly Error

I want to print elements from an array using a foreach loop that gives an error . The j prefix for the j: foreach element is not associated . "

Below is the code 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>
+4
source share
1 answer

I believe jelly is case sensitive. Try changing j:foreachto f:forEach.

<j:forEach var="jvar_word" items="${words}">
    <p> ${jvar_word} </p>
</j:forEach>
+2
source

Source: https://habr.com/ru/post/1689938/


All Articles