Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tiles.jsp.taglib
Class PutAttributeTag

    java.lang.Object
      javax.servlet.jsp.tagext.SimpleTagSupport
          org.apache.tiles.jsp.taglib.PutAttributeTag

All Implemented Interfaces:
  javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag

    public class PutAttributeTag

extends javax.servlet.jsp.tagext.SimpleTagSupport

Put an attribute in enclosing attribute container tag.

Enclosing attribute container tag can be :

- <initContainer>
- <definition>
- <insertAttribute>
- <insertDefinition>
- <putList>

Exception is thrown if no appropriate tag can be found.

Put tag can have following atributes :

- name : Name of the attribute
- value : 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), 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.

Version:
  $Rev: 796822 $ $Date: 2009-07-22 20:25:50 +0200 (mer, 22 lug 2009) $

Constructor Summary
`PutAttributeTag()`

Method Summary
`void` | `doTag()`
`java.lang.String` | `getExpression()` Returns the expression to calculate the value from.
`java.lang.String` | `getName()` Returns the name of the attribute.
`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.
`boolean` | `isCascade()` Checks if the attribute should be cascaded to nested definitions.
`void` | `setCascade(boolean cascade)` Sets the property that tells if the attribute should be cascaded to nested definitions.
`void` | `setExpression(java.lang.String expression)` Sets the expression to calculate the value from.
`void` | `setName(java.lang.String name)` Sets the name of the attribute.
`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.SimpleTagSupport
`findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PutAttributeTag

    public PutAttributeTag()

Method Detail

### getName

    public java.lang.String getName()

  Returns the name of the attribute.

  Returns:
    The name of the attribute.

### setName

    public void setName(java.lang.String name)

  Sets the name of the attribute.

  Parameters:
    `name` - The name of the attribute.

### isCascade

    public boolean isCascade()

  Checks if the attribute should be cascaded to nested definitions.

  Returns:
    `true` if the attribute will be cascaded.
  Since:
    2.1.0

### setCascade

    public void setCascade(boolean cascade)

  Sets the property that tells if the attribute should be cascaded to nested definitions.

  Parameters:
    `cascade` - `true` if the attribute will be cascaded.
  Since:
    2.1.0

### 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.

### getExpression

    public java.lang.String getExpression()

  Returns the expression to calculate the value from. Use this parameter, or value, or body.

  Returns:
    The expression
  Since:
    2.2.0

### setExpression

    public void setExpression(java.lang.String expression)

  Sets the expression to calculate the value from. Use this parameter, or value, or body.

  Parameters:
    `expression` - The expression
  Since:
    2.2.0

### getType

    public java.lang.String getType()

  Returns content type: string, template or definition.

  - String : Content is printed directly.
  - template : Content is included from specified URL. Value is used as an URL.
  - definition : Value denote a definition defined in factory (xml file). Definition will be searched in the inserted tile, in a `<insert attribute="attributeName">` tag, where 'attributeName' is the name used for this tag.

  Returns:
    The attribute type.

### setType

    public void setType(java.lang.String type)

  Sets content type: string, template or definition.

  - String : Content is printed directly.
  - template : Content is included from specified URL. Value is used as an URL.
  - definition : Value denote a definition defined in factory (xml file). Definition will be searched in the inserted tile, in a `<insert attribute="attributeName">` tag, where 'attributeName' is the name used for this tag.

  Parameters:
    `type` - The attribute type.

### doTag

    public void doTag()
               throws javax.servlet.jsp.JspException,
                      java.io.IOException

  Specified by:
    `doTag` in interface `javax.servlet.jsp.tagext.SimpleTag`
  Overrides:
    `doTag` in class `javax.servlet.jsp.tagext.SimpleTagSupport`
  Throws:
    `javax.servlet.jsp.JspException`
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.