Apache Struts API Documentation: Class PutTag

Apache Struts API


org.apache.struts.taglib.tiles Class PutTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javax.servlet.jsp.tagext.BodyTagSupport
              |
              +--org.apache.struts.taglib.tiles.PutTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, ComponentConstants, java.io.Serializable, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
AddTag

public class PutTag
extends javax.servlet.jsp.tagext.BodyTagSupport
implements ComponentConstants

Put an attribute in enclosing attribute container tag. Enclosing attribute container tag can be : <insert> or <definition>. Exception is thrown if no appropriate tag can be found. Put tag can have following atributes :

    • name : Name of the attribute
      value | content : value to put as attribute
      type : value type. Only valid if value is a String and is set by value="something" or by a bean. Possible type are : string (value is used as direct string), page | template (value is used as a page url to insert), definition (value is used as a definition name to insert)
      direct : Specify if value is to be used as a direct string or as a page url to insert. This is another way to specify the type. It only apply if value is set as a string, and type is not present.
      beanName : Name of a bean used for setting value. Only valid if value is not set. If property is specified, value come from bean's property. Otherwise, bean itself is used for value.
      beanProperty : Name of the property used for retrieving value.
      beanScope : Scope containing bean.
      role : Role to check when 'insert' will be called. If enclosing tag is <insert>, role is checked immediately. If enclosing tag is <definition>, role will be checked when this definition will be inserted.
  • 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 attributeName
              Name of attribute to put in component context.
    private  java.lang.String beanName
              Bean name attribute.
    private  java.lang.String beanProperty
              Bean property attribute.
    private  java.lang.String beanScope
              Bean scope attribute.
    protected  java.lang.String body
              The body content of this tag.
    private  java.lang.String direct
              JSP Template compatibility.
    protected  java.lang.Object realValue
              Cached real value computed from tag attributes.
    private  java.lang.String role
              Role attribute.
    private  java.lang.Object value
              Associated attribute value.
    private  java.lang.String valueType
              Requested type for the value.
     
    Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
    bodyContent
     
    Fields inherited from class javax.servlet.jsp.tagext.TagSupport
    id, pageContext, parent, values
     
    Fields inherited from interface org.apache.struts.taglib.tiles.ComponentConstants
    COMPONENT_CONTEXT, COMPONENT_SCOPE, EXCEPTION_KEY, LOCALE_KEY
     
    Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
    EVAL_BODY_TAG
     
    Fields inherited from interface javax.servlet.jsp.tagext.Tag
    EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
     
    Constructor Summary
    PutTag()
              Default constructor.
     
    Method Summary
    protected  void callParent()
              Find parent tag which must implement AttributeContainer.
    protected  void computeRealValue()
              Compute real value according to tag attributes.
     int doAfterBody()
              Save the body content of this tag (if any)
     int doEndTag()
              Do end tag.
     int doStartTag()
              Do start tag.
    protected  PutTagParent findEnclosingPutTagParent()
              Find parent tag which must implement AttributeContainer.
     java.lang.String getBeanName()
              Get bean name.
     java.lang.String getBeanProperty()
              Get bean property.
     java.lang.String getBeanScope()
              Get bean scope.
     java.lang.String getContent()
              Get content.
     java.lang.String getName()
              Get name.
     java.lang.Object getRealValue()
              Get real value according to tag attribute.
    protected  void getRealValueFromBean()
              Extract real value from specified bean.
     java.lang.String getRole()
              Get role attribute
     java.lang.String getType()
              Get type.
     java.lang.String getValue()
              Get value.
     void release()
              Release all allocated resources.
    protected  void releaseInternal()
              Release internal properties.
     void setBeanName(java.lang.String value)
              Set bean name.
     void setBeanProperty(java.lang.String value)
              Set bean property.
     void setBeanScope(java.lang.String value)
              Set bean scope.
     void setContent(java.lang.Object value)
              Set content.
     void setContent(java.lang.String value)
              Set content.
     void setDirect(java.lang.String isDirect)
              Set direct.
     void setName(java.lang.String value)
              Set name.
     void setObjectValue(java.lang.Object value)
              Set property value as an object.
     void setRole(java.lang.String role)
              Set role attribute.
     void setType(java.lang.String value)
              Set type.
     void setValue(java.lang.Object value)
              Set value.
     void setValue(java.lang.String value)
              Set value.
     
    Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
    doInitBody, 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, registerNatives, toString, wait, wait, wait
     
    Methods inherited from interface javax.servlet.jsp.tagext.Tag
    getParent, setPageContext, setParent
     

    Field Detail

    attributeName

    protected java.lang.String attributeName
    Name of attribute to put in component context.

    value

    private java.lang.Object value
    Associated attribute value.

    direct

    private java.lang.String direct
    JSP Template compatibility.

    valueType

    private java.lang.String valueType
    Requested type for the value.

    beanName

    private java.lang.String beanName
    Bean name attribute.

    beanProperty

    private java.lang.String beanProperty
    Bean property attribute.

    beanScope

    private java.lang.String beanScope
    Bean scope attribute.

    role

    private java.lang.String role
    Role attribute.

    realValue

    protected java.lang.Object realValue
    Cached real value computed from tag attributes.

    body

    protected java.lang.String body
    The body content of this tag.
    Constructor Detail

    PutTag

    public PutTag()
    Default constructor.
    Method Detail

    release

    public void release()
    Release all allocated resources.
    Overrides:
    release in class javax.servlet.jsp.tagext.BodyTagSupport

    releaseInternal

    protected void releaseInternal()
    Release internal properties.

    setName

    public void setName(java.lang.String value)
    Set name.

    getName

    public java.lang.String getName()
    Get name.

    setValue

    public void setValue(java.lang.String value)
    Set value. Method added to satisfy Tomcat (bug ?).

    getValue

    public java.lang.String getValue()
    Get value. Method added to satisfy Tomcat (bug ?).

    setValue

    public void setValue(java.lang.Object value)
    Set value.

    setObjectValue

    public void setObjectValue(java.lang.Object value)
    Set property value as an object. Added because some web containers react badly to value as Object.

    setContent

    public void setContent(java.lang.String value)
    Set content. Method added to satisfy Tomcat (bug ?).

    getContent

    public java.lang.String getContent()
    Get content. Method added to satisfy Tomcat (bug ?).

    setContent

    public void setContent(java.lang.Object value)
    Set content.

    setDirect

    public void setDirect(java.lang.String isDirect)
    Set direct. Method added for compatibility with JSP1.1.

    setType

    public void setType(java.lang.String value)
    Set type.

    getType

    public java.lang.String getType()
    Get type.

    setBeanName

    public void setBeanName(java.lang.String value)
    Set bean name.

    getBeanName

    public java.lang.String getBeanName()
    Get bean name.

    setBeanProperty

    public void setBeanProperty(java.lang.String value)
    Set bean property.

    getBeanProperty

    public java.lang.String getBeanProperty()
    Get bean property.

    setBeanScope

    public void setBeanScope(java.lang.String value)
    Set bean scope.

    getBeanScope

    public java.lang.String getBeanScope()
    Get bean scope.

    setRole

    public void setRole(java.lang.String role)
    Set role attribute.
    Parameters:
    role - The role the user must be in to store content.

    getRole

    public java.lang.String getRole()
    Get role attribute
    Returns:
    The role defined in the tag or null.

    getRealValue

    public java.lang.Object getRealValue()
                                  throws javax.servlet.jsp.JspException
    Get real value according to tag attribute. Real value is the value computed after attribute processing.
    Returns:
    Real value.
    Throws:
    javax.servlet.jsp.JspException - If something goes wrong while getting value from bean.

    computeRealValue

    protected void computeRealValue()
                             throws javax.servlet.jsp.JspException
    Compute real value according to tag attributes.
    Throws:
    javax.servlet.jsp.JspException - If something goes wrong while getting value from bean.

    getRealValueFromBean

    protected void getRealValueFromBean()
                                 throws javax.servlet.jsp.JspException
    Extract real value from specified bean.
    Throws:
    javax.servlet.jsp.JspException - If something goes wrong while getting value from bean.

    doStartTag

    public int doStartTag()
                   throws javax.servlet.jsp.JspException
    Do start tag.
    Overrides:
    doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport

    doAfterBody

    public int doAfterBody()
                    throws javax.servlet.jsp.JspException
    Save the body content of this tag (if any)
    Overrides:
    doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
    Throws:
    javax.servlet.jsp.JspException - if a JSP exception has occurred

    doEndTag

    public int doEndTag()
                 throws javax.servlet.jsp.JspException
    Do end tag.
    Overrides:
    doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport

    callParent

    protected void callParent()
                       throws javax.servlet.jsp.JspException
    Find parent tag which must implement AttributeContainer.
    Throws:
    javax.servlet.jsp.JspException - If we can't find an appropriate enclosing tag.

    findEnclosingPutTagParent

    protected PutTagParent findEnclosingPutTagParent()
                                              throws javax.servlet.jsp.JspException
    Find parent tag which must implement AttributeContainer.
    Throws:
    javax.servlet.jsp.JspException - If we can't find an appropriate enclosing tag.


    Copyright © 2000-2005 - The Apache Software Foundation