Clarity

What is in my Gel JellyContext? 

Aug 13, 2014 06:50 PM

In a Gel script every tag that uses the “var” attribute will save the results of the tag into the JellyContext under the string identified by the “var” attribute.

 

So once in a while when debugging a Gel script, I want to inspect the scripts variables.  I use this to find misspelled variables, check expected values and figure out the underlying object types.

 

So to take a peek at your JellyContext, just drop this inside your Gel script at a location of interest.

 

<gel:log>Dump Context Variables</gel:log>
<core:set var="entries" value="${context.getVariables().entrySet().toArray()}" />    
<core:forEach var="entry" items="${entries}">
    <core:if test="${!entry.getKey().equalsIgnoreCase('systemScope')}" >
        <gel:log> ${entry.getKey()} = ${entry.getValue()} |  ${entry.getValue().getClass().getName()} </gel:log>
    </core:if>
</core:forEach>

 

V/r,

Gene

Statistics
0 Favorited
2 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.