What is in my Gel JellyContext?

Document created by gcubed Champion on Aug 13, 2014
Version 1Show Document
  • View in full screen mode

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>