[tag libraries] [tags]
The following document contains a summary of all theJellytag libraries.
[tag libraries] [tags]
Library | Description |
---|---|
jelly:core |
The core Tags from the JSTL plus Jelly extensions. |
The core Tags from the JSTL plus Jelly extensions.
Tag Name | Description |
---|---|
arg | An argument to a org.apache.commons.jelly.tags.core.NewTagor org.apache.commons.jelly.tags.core.InvokeTag.This tag MUST be enclosed within an org.apache.commons.jelly.tags.core.ArgTagParentimplementation. |
break | A tag which terminates the execution of the current <forEach>or ≶while>loop. This tag can take an optional boolean test attribute which if its truethen the break occurs otherwise the loop continues processing. |
case | A tag which conditionally evaluates its body ifmy valueattribute equals my ancestor <switch>tag's "on"attribute.This tag must be contained within the body of some <switch>tag. |
catch | A tag which catches exceptions thrown by its body.This allows conditional logic to be performed based on if exceptionsare thrown or to do some kind of custom exception logging logic. |
choose | A tag which conditionally evaluates its body based on some condition |
default | A tag which conditionally evaluates its body ifnone of its preceeding sibling <case>tags have been evaluated.This tag must be contained within the body of some <switch>tag. |
expr | A tag which evaluates an expression |
file | A tag that pipes its body to a file denoted by the name attribute or to an in memory Stringwhich is then output to a variable denoted by the var variable. |
forEach | Iterates over a collection, iterator or an array of objects.Uses the same syntax as the
JSTL
forEach
tag does.
|
getStatic | A tag which can retrieve the value of a static field of a given class.The following attributes are required:
<j:getStatic var="closeOperation" className="javax.swing.JFrame"field="EXIT_ON_CLOSE"/> |
if | A tag which conditionally evaluates its body based on some condition |
import | Imports another script.
By default, the imported script does not have access tothe parent script's variable context. This behaviourmay be modified using the
|
include | A tag which conditionally evaluates its body based on some condition |
invoke | A tag which calls a method in an object instantied by core:new |
invokeStatic | A Tag which can invoke a static method on a class, without aninstance of the class being needed.
Like the org.apache.commons.jelly.tags.core.InvokeTag, this tag can take a set ofarguments using the org.apache.commons.jelly.tags.core.ArgTag.
The following attributes are required:
|
jelly | The root Jelly tag which should be evaluated first |
mute | A tag which executes its body but passing no output.
Using this tag will still take the time to perform toString on each objectreturned to the output (but this toString value is discarded.A future version should go more internally so that this is avoided. |
new | A tag which creates a new object of the given type |
otherwise | The otherwise block of a choose/when/otherwise group of tags |
parse | Parses the output of this tags body or of a given String as a Jelly scriptthen either outputting the Script as a variable or executing the script. |
remove | A tag which removes the variable of the given name from the current variable scope. |
scope | A tag which creates a new child variable scope for its body.So any variables defined within its body will no longer be in scopeafter this tag. |
set | A tag which sets a variable from the result of an expression |
setProperties | A tag which sets the bean properties on the given bean.So if you used it as follows, for example using the <j:new>tag.
<j:new className="com.acme.Person" var="person"/> <j:setProperties object="${person}" name="James" location="${loc}"/>Then it would set the name and location properties on the bean denoted bythe expression ${person}. This tag can also be nested inside a bean tag such as the <useBean>tagor a JellySwing tag to set one or more properties, maybe inside some conditionallogic. |
switch | Executes the child <case>tag whose value equals my on attribute.Executes a child <default>tag when present and no <case>tag hasyet matched. |
thread | A tag that spawns the contained script in a separate thread |
useBean | A tag which instantiates an instance of the given classand then sets the properties on the bean.The class can be specified via a java.lang.Classinstance ora String which will be used to load the class using either the currentthread's context class loader or the class loader used to load thisJelly library.This tag can be used it as follows,
<j:useBean var="person" class="com.acme.Person" name="James" location="${loc}"/> <j:useBean var="order" class="${orderClass}" amount="12" price="123.456"/> |
useList | A tag which creates a List implementation and optionallyadds all of the elements identified by the items attribute.The exact implementation of List can be specified via theclass attribute |
when | A tag which conditionally evaluates its body based on some condition |
while | A tag which performs an iteration while the result of an expression is true. |
whitespace | A simple tag used to preserve whitespace inside its body |
[tag libraries] [tags]
An argument to a org.apache.commons.jelly.tags.core.NewTagor org.apache.commons.jelly.tags.core.InvokeTag.This tag MUST be enclosed within an org.apache.commons.jelly.tags.core.ArgTagParentimplementation.
Attribute Name | Type | Description |
---|---|---|
classLoader | ClassLoader | Set the class loader to be used for instantiating application objectswhen required. |
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
type | String | The name of the argument class or type, if any.This may be a fully specified class name ora primitive type name(
boolean
|
useContextClassLoader | boolean | Determine whether to use the Context ClassLoader (the one found bycalling
Thread.currentThread().getContextClassLoader()
)to resolve/load classes. If notusing Context ClassLoader, then the class-loading defaults tousing the calling-class' ClassLoader.
|
value | Object | The (possibly null) value of this argument. |
A tag which terminates the execution of the current <forEach>or ≶while>loop. This tag can take an optional boolean test attribute which if its truethen the break occurs otherwise the loop continues processing.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
test | Expression | Sets the Jelly expression to evaluate (optional).If this is
null
or evaluates to
true
then the loop is terminated
|
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | String | Sets the variable name to export indicating if the item was broken |
A tag which conditionally evaluates its body ifmy valueattribute equals my ancestor <switch>tag's "on"attribute.This tag must be contained within the body of some <switch>tag.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
fallThru | boolean | |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
value | Expression |
A tag which catches exceptions thrown by its body.This allows conditional logic to be performed based on if exceptionsare thrown or to do some kind of custom exception logging logic.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | String | Sets the name of the variable which is exposed with the Exception that getsthrown by evaluating the body of this tag or which is set to null if there isno exception thrown. |
A tag which conditionally evaluates its body based on some condition
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag which conditionally evaluates its body ifnone of its preceeding sibling <case>tags have been evaluated.This tag must be contained within the body of some <switch>tag.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
fallThru | boolean | |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag which evaluates an expression
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
value | Expression | Sets the Jexl expression to evaluate. |
A tag that pipes its body to a file denoted by the name attribute or to an in memory Stringwhich is then output to a variable denoted by the var variable.
Attribute Name | Type | Description |
---|---|---|
append | boolean | Sets wether to append at the end of the file(not really something you normally do with an XML file). |
encoding | String | Sets the XML encoding mode, which defaults to UTF-8 |
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
name | String | Sets the file name for the output |
omitXmlDeclaration | boolean | Sets whether the XML declaration should be output or not |
outputMode | String | Sets the output mode, whether XML or HTML |
prettyPrint | boolean | Sets whether pretty printing mode is turned on. The default is off so that whitespace is preserved |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | String | Sets the var. |
Iterates over a collection, iterator or an array of objects.Uses the same syntax as the
JSTL
forEach
tag does.
Attribute Name | Type | Description |
---|---|---|
begin | int | Sets the starting index value |
end | int | Sets the ending index value |
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
indexVar | String | Sets the variable name to export the current index counter to |
items | Expression | Sets the expression used to iterate over.This expression could resolve to an Iterator, Collection, Map, Array,Enumeration or comma separated String. |
step | int | Sets the index increment step |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | String | Sets the variable name to export for the item being iterated over |
varStatus | String | Sets the variable name to export the current status to.The status is an implementation of the JSTL LoopTagStatus interface that providesthe following bean properties:
|
A tag which can retrieve the value of a static field of a given class.The following attributes are required:
<j:getStatic var="closeOperation" className="javax.swing.JFrame"field="EXIT_ON_CLOSE"/>
Attribute Name | Type | Description |
---|---|---|
className | String | Sets the fully qualified name of the class containing the static field. |
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
field | String | Sets the name of the field to retrieve. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | String | Sets the name of the variable exported by this tag. |
A tag which conditionally evaluates its body based on some condition
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
test | Expression | Sets the Jelly expression to evaluate. If this returns true, the body ofthe tag is evaluated |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
Imports another script.
By default, the imported script does not have access tothe parent script's variable context. This behaviourmay be modified using the
inherit
attribute.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
file | String | Sets the file for the script to evaluate. |
inherit | boolean | Sets whether property inheritence is enabled or disabled |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
uri | String | Sets the URI (relative URI or absolute URL) for the script to evaluate. |
A tag which conditionally evaluates its body based on some condition
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
export | String | |
file | File | Sets the file to be included which is either an absolute file or a filerelative to the current directory |
inherit | String | |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
uri | String | Sets the URI (relative URI or absolute URL) for the script to evaluate. |
A tag which calls a method in an object instantied by core:new
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
exceptionVar | String | Sets the name of a variable that exports the exception thrown bythe method's invocation (if any) |
method | String | |
on | Object | |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | String | Sets the name of the variable exported by this tag |
A Tag which can invoke a static method on a class, without aninstance of the class being needed.
Like the
org.apache.commons.jelly.tags.core.InvokeTag, this tag can take a set ofarguments using the org.apache.commons.jelly.tags.core.ArgTag.
The following attributes are required:
Attribute Name | Type | Description |
---|---|---|
className | String | Sets the fully qualified class name containing the static method |
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
exceptionVar | String | Sets the name of a variable that exports the exception thrown bythe method's invocation (if any) |
method | String | Sets the name of the method to invoke |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | String | Sets the name of the variable exported by this tag |
The root Jelly tag which should be evaluated first
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag which executes its body but passing no output.
Using this tag will still take the time to perform toString on each objectreturned to the output (but this toString value is discarded.A future version should go more internally so that this is avoided.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag which creates a new object of the given type
Attribute Name | Type | Description |
---|---|---|
classLoader | ClassLoader | Set the class loader to be used for instantiating application objectswhen required. |
className | String | Sets the class name of the object to instantiate |
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
useContextClassLoader | boolean | Determine whether to use the Context ClassLoader (the one found bycalling
Thread.currentThread().getContextClassLoader()
)to resolve/load classes. If notusing Context ClassLoader, then the class-loading defaults tousing the calling-class' ClassLoader.
|
var | String | Sets the name of the variable exported by this tag |
The otherwise block of a choose/when/otherwise group of tags
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
Parses the output of this tags body or of a given String as a Jelly scriptthen either outputting the Script as a variable or executing the script.
Attribute Name | Type | Description |
---|---|---|
XMLReader | XMLReader | Sets the XMLReader used for parsing |
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
jellyParser | XMLParser | Sets the jellyParser. |
text | String | Sets the text to be parsed by this parser |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | String | Sets the variable name that will be used for the Document variable created |
A tag which removes the variable of the given name from the current variable scope.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
var | Expression | Sets the name of the variable which will be removed by this tag.. |
A tag which creates a new child variable scope for its body.So any variables defined within its body will no longer be in scopeafter this tag.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag which sets a variable from the result of an expression
Attribute Name | Type | Description |
---|---|---|
defaultValue | Expression | Sets the default value to be used if the value exprsesion resultsin a null value or blank String |
encode | boolean | Sets whether the body of the tag should be XML encoded as text (so that <and >areencoded as < and >) or leave the text as XML which is the default.This is only used if this tag is specified with no value so that the text body of thistag is used as the body. |
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
property | String | Sets the name of the property to set on the target object. |
scope | String | Sets the variable scope for this variable. For example setting this value to 'parent' willset this value in the parent scope. When Jelly is run from inside a Servlet environmentthen other scopes will be available such as 'request', 'session' or 'application'.Other applications may implement their own custom scopes. |
target | Object | Sets the target object on which to set a property. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
value | Expression | Sets the expression to evaluate. |
var | String | Sets the variable name to define for this expression |
A tag which sets the bean properties on the given bean.So if you used it as follows, for example using the <j:new>tag.
<j:new className="com.acme.Person" var="person"/> <j:setProperties object="${person}" name="James" location="${loc}"/>Then it would set the name and location properties on the bean denoted bythe expression ${person}.
This tag can also be nested inside a bean tag such as the <useBean>tagor a JellySwing tag to set one or more properties, maybe inside some conditionallogic.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
Executes the child <case>tag whose value equals my on attribute.Executes a child <default>tag when present and no <case>tag hasyet matched.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
on | Expression | Sets the value to switch on.Note that the org.apache.commons.jelly.expression.Expressionis evaluated only once, when the <switch>tag is evaluated. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag that spawns the contained script in a separate thread
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
file | String | Set the file which is generated from the output |
name | String | Sets the name of the thread. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
xmlOutput | XMLOutput | Sets the destination of output |
A tag which instantiates an instance of the given classand then sets the properties on the bean.The class can be specified via a java.lang.Classinstance ora String which will be used to load the class using either the currentthread's context class loader or the class loader used to load thisJelly library.This tag can be used it as follows,
<j:useBean var="person" class="com.acme.Person" name="James" location="${loc}"/> <j:useBean var="order" class="${orderClass}" amount="12" price="123.456"/>
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
ignoreUnknownProperties | boolean | If this tag finds an attribute in the XML that's notignored by org.apache.commons.jelly.tags.core.UseBeanTag.ignorePropertiesand isn't abean property, should it throw an exception? |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag which creates a List implementation and optionallyadds all of the elements identified by the items attribute.The exact implementation of List can be specified via theclass attribute
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
ignoreUnknownProperties | boolean | If this tag finds an attribute in the XML that's notignored by org.apache.commons.jelly.tags.core.UseBeanTag.ignorePropertiesand isn't abean property, should it throw an exception? |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag which conditionally evaluates its body based on some condition
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
test | Expression | Sets the expression to evaluate. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A tag which performs an iteration while the result of an expression is true.
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
test | Expression | Setter for the expression |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |
A simple tag used to preserve whitespace inside its body
Attribute Name | Type | Description |
---|---|---|
escapeText | boolean | Sets whether the body of the tag should be escaped as text (so that <and >areescaped as < and >), which is the default or leave the text as XML. |
trim | boolean | Sets whether whitespace inside this tag should be trimmed or not.Defaults to true so whitespace is trimmed |