public class NestedPropertyHelper extends Object
A simple helper class that does everything that needs to be done to get the nested tag extension to work. The tags will pass in their relative properties and this class will leverage the accessibility of the request object to calculate the nested references and manage them from a central place.
The helper method setNestedProperties(javax.servlet.http.HttpServletRequest, org.apache.struts.taglib.nested.NestedPropertySupport)
takes a reference to the
tag itself so all the simpler tags can have their references managed from a
central location. From here, the reference to a provided name is also
preserved for use.
With all tags keeping track of themselves, we only have to seek to the next level, or parent tag, were a tag will append a dot and it's own property.
Modifier and Type | Field and Description |
---|---|
static String |
NESTED_INCLUDES_KEY |
Constructor and Description |
---|
NestedPropertyHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
deleteReference(javax.servlet.http.HttpServletRequest request)
Deletes the nested reference from the request object.
|
static String |
getAdjustedProperty(javax.servlet.http.HttpServletRequest request,
String property)
Get the adjusted property.
|
static String |
getCurrentName(javax.servlet.http.HttpServletRequest request,
NestedNameSupport nested)
Returns the bean name from the request object that the properties
are nesting against.
|
static String |
getCurrentProperty(javax.servlet.http.HttpServletRequest request)
Returns the current nesting property from the request object.
|
static void |
setName(javax.servlet.http.HttpServletRequest request,
String name)
Sets the provided name into the request object for reference by the
other nested tags.
|
static void |
setNestedProperties(javax.servlet.http.HttpServletRequest request,
NestedPropertySupport tag)
Helper method that will set all the relevant nesting properties for the
provided tag reference depending on the implementation.
|
static void |
setProperty(javax.servlet.http.HttpServletRequest request,
String property)
Sets the provided property into the request object for reference by the
other nested tags.
|
public static final String NESTED_INCLUDES_KEY
public static final String getCurrentProperty(javax.servlet.http.HttpServletRequest request)
request
- object to fetch the property reference frompublic static final String getCurrentName(javax.servlet.http.HttpServletRequest request, NestedNameSupport nested)
Returns the bean name from the request object that the properties are nesting against.
The requirement of the tag itself could be removed in the future,
but is required if support for the
request
- object to fetch the bean reference fromnested
- tag from which to start the search frompublic static final String getAdjustedProperty(javax.servlet.http.HttpServletRequest request, String property)
request
- to pull the reference fromproperty
- to retrieve the evaluated nested property withpublic static final void setProperty(javax.servlet.http.HttpServletRequest request, String property)
request
- object to set the new property intoproperty
- String to set the property topublic static final void setName(javax.servlet.http.HttpServletRequest request, String name)
request
- object to set the new name intoname
- String to set the name topublic static final void deleteReference(javax.servlet.http.HttpServletRequest request)
request
- object to remove the reference frompublic static void setNestedProperties(javax.servlet.http.HttpServletRequest request, NestedPropertySupport tag)
request
- object to pull references fromtag
- to set the nesting values intoCopyright © 2000–2017 Apache Software Foundation. All rights reserved.