org.apache.tiles.jsp.taglib
Class AddAttributeTag

Package class diagram package AddAttributeTag
java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.apache.tiles.jsp.taglib.AddAttributeTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, DefinitionTagParent
Direct Known Subclasses:
AddListAttributeTag, PutAttributeTag

public class AddAttributeTag
extends javax.servlet.jsp.tagext.BodyTagSupport
implements DefinitionTagParent

Adds an attribute in enclosing attribute container tag.

Enclosing attribute container tag can be :

(or any other tag which implements the AddAttributeTagParent interface. Exception is thrown if no appropriate tag can be found.

Put tag can have following atributes :

Value can also come from tag body. Tag body is taken into account only if value is not set by one of the tag attributes. In this case Attribute type is "string", unless tag body define another type.

See Also:
Serialized Form

Field Summary
protected  java.lang.String role
          The role to check.
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
AddAttributeTag()
           
 
Method Summary
 int doAfterBody()
          Save the body content of this tag (if any).
 int doEndTag()
          
protected  void execute()
          Executes the processing of this tag, calling its parent tag.
 java.lang.String getRole()
          Returns the role to check.
 java.lang.String getType()
           Returns content type: string, template or definition.
 java.lang.Object getValue()
          Returns the attribute value.
protected  boolean isAccessAllowed()
          Checks if the user is inside the specified role.
 void processNestedDefinitionName(java.lang.String definitionName)
          Process the nested <tiles:definition> tag.
 void release()
          Release all allocated resources.
 void setRole(java.lang.String role)
          Sets the role to check.
 void setType(java.lang.String type)
           Sets content type: string, template or definition.
 void setValue(java.lang.Object value)
          Sets the attribute value.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, doStartTag, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Field Detail

role

protected java.lang.String role
The role to check. If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped).

Constructor Detail

AddAttributeTag

public AddAttributeTag()
Method Detail

getRole

public java.lang.String getRole()
Returns the role to check. If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped).

Returns:
The role to check.

setRole

public void setRole(java.lang.String role)
Sets the role to check. If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped).

Parameters:
role - The role to check.

getValue

public java.lang.Object getValue()
Returns the attribute value.

Returns:
Attribute value. Can be a String or Object.

setValue

public void setValue(java.lang.Object value)
Sets the attribute value.

Parameters:
value - Attribute value. Can be a String or Object.

getType

public java.lang.String getType()

Returns content type: string, template or definition.

Returns:
The attribute type.

setType

public void setType(java.lang.String type)

Sets content type: string, template or definition.

Parameters:
type - The attribute type.

release

public void release()
Release all allocated resources.

Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.BodyTagSupport

doAfterBody

public int doAfterBody()
Save the body content of this tag (if any).

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
It returns SKIP_BODY.

doEndTag

public int doEndTag()
             throws TilesJspException

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
TilesJspException

processNestedDefinitionName

public void processNestedDefinitionName(java.lang.String definitionName)
Process the nested <tiles:definition> tag.

Specified by:
processNestedDefinitionName in interface DefinitionTagParent
Parameters:
definitionName - Nested definition name.

execute

protected void execute()
                throws TilesJspException
Executes the processing of this tag, calling its parent tag.

Throws:
TilesJspException - If something goes wrong during execution.

isAccessAllowed

protected boolean isAccessAllowed()
Checks if the user is inside the specified role.

Returns:
true if the user is allowed to have the tag rendered.