This tag library brings a nested context to the functionality of the Struts custom tag library.
It's written in a layer that extends the current Struts tags, building on their logic and functionality. The layer enables the tags to be aware of the tags which surround them so they can correctly provide the nesting property reference to the Struts system.
It's all about nesting beans...
A bean holds a reference to another bean internally, and all access to that
bean is handled through the current bean. This act of having one bean's
access go through another bean is known as "nesting beans". The first bean
is known as the parent bean. The bean which it references, is known as a
child bean. The terms "parent" and "child" are commonly used to describe the
model's hierarchy.
A simple example...
Take an object which represents a monkey. The monkey's job is to pick
bunches of bananas. On each bunch picked hangs many bananas. If this case
was translated to bean objects, the monkey object would have a reference to
the bunch objects he picked, and each bunch object would hold a reference
to the bananas hanging in the bunch.
To describe this...
The monkey object is the parent to the bunch object, and the bunch object
is a child of the monkey object. The bunch object is parent to its child
banana objects, and the child banana objects children of the bunch object.
The monkey is higher in the hierarchy than the bananas, and the bananas
lower in the hierarchy to the bunches.
One special term to remember is for the most parent class, which is known as the "root" object which starts the hierarchy.
Nested tags are all about efficiently managing this style of hierarchy structure within your JSP markup.
Important Note: Nearly all these tags extend tags from
other libraries to bring their functionality into the nested context.
Nesting relies on the tags working against the one bean model, and managing
the properties so that they become relative to the properties they are
nested within. In doing so, the tags will set the "name" attribute internally
(where applicable), and in many cases will rely on the "property" attribute
being set so it can be updated internally to become nested. The original tags
on occasion provide options that don't use the "name" and "property"
attributes. These uses will then fall outside the nested context, and will
most likely cause error. To take advantage of these options, markup using
the original tag for these cases. For an example see the
<nested:options>
tag.
This tag provides a simple method of defining a logical nesting level in the nested hierarchy. It run no explicit logic, is simply a place holder. It also means you can remove the need for explicit setting of level properties in child tags.
Just as the iterate tag provide a parent to other tags, this does the same but there is no logic for iterating or otherwise.
Example...
<nested:write property="myNestedLevel.propertyOne" /> <nested:write property="myNestedLevel.propertyTwo" /> <nested:write property="myNestedLevel.propertyThree" />
Can instead become...
<nested:nest property="myNestedLevel" > <nested:write property="propertyOne" /> <nested:write property="propertyTwo" /> <nested:write property="propertyThree" /> </nested:nest >]]>
This tag is provided to allow the nested tags to find a common bean
reference without the need for a form and its relative overhead. As
long as the name
attribute of this tag matches the name
of a bean in scope of the JSP (ie: Struts tags can find it via usual
means). For example you can load a bean for use with the
jsp:useBean
tag.
The tag can also be used without specifying the name
attribute, but this is only in the case that the current JSP is a
dynamic include specified in another file. You will not be able to run
the tag without a name unless this inclusion is in place. Otherwise
the nested tags will not have the bean and property references that they
need to provide their logic.
Note: The access to a bean via the name
attribute takes priority over looking for the reference from other
parent tags. So if a name is specified, a bean will have to be there
waiting for it. It was made this way so that you could use separate
beans within a JSP that itself is an inclusion into another.
This tag is an extension of the
<bean:define>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<bean:message>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<bean:size>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<bean:write>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:checkbox>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:errors>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:file>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:form>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:hidden>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:image>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:img>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:link>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:messages>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:multibox>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:options>
tag. Please consult its documentation for information on tag attributes
and usage details.
Note: The nested context of this tag relies on the use
of the "property" property, and the internal use of the "name" property.
The nested tags rely on these properties and will attempt to set them
itself. The <html:options>
tag this tag extended
allows other options for the tag which don't use these properties.
To take advantage of these options, markup using the
<html:options>
tag instead of the nested tag.
For example, the "collections" option allows you to specify a separate bean reference which itself is a list of objects with properties to access the title and value parts of the html option tag. You can use this in a nested context (the list is a property of a nested bean) by using the nested define tag and the original options tag.
<nested:nest property="myNestedLevel" /> <nested:define property="collectionList" /> <html:options collection="collectionList" property="valueProperty" labelProperty="labelProperty" /> </nested:nest >]]>
This tag is an extension of the
<html:optionsCollection>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:password>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:radio>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:select>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:submit>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:text>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<html:textarea>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:empty>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:equal>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:greaterEqual>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:greaterThan>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:iterate>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:lessEqual>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:lessThan>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:match>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:messagesNotPresent>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:messagesPresent>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:notEmpty>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:notEqual>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:notMatch>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:notPresent>
tag. Please consult its documentation for information on tag attributes
and usage details.
This tag is an extension of the
<logic:present>
tag. Please consult its documentation for information on tag attributes
and usage details.