Apache Struts 2 Documentation > Home > Guides > Tag Developers Guide > Struts Tags > Tag Reference > Generic Tag Reference > property
Added by tm_jee, last edited by Don Brown on Jan 06, 2007  (view change)
Please make sure you have read the Tag Syntax document and understand how tag attribute syntax works.

Description

Used to get the property of a value, which will default to the top of the stack if none is specified.

Parameters

Name

Required

Default

Evaluated

Type

Description

default false true String The default value to be used if value attribute is null
escape false true true Boolean Whether to escape HTML
id false true String id for referencing element. For UI and form tags it will be used as HTML id attribute
value false <top of stack> true Object Value to be displayed

Examples

<s:push value="myBean">
    <!-- Example 1: -->
    <s:property value="myBeanProperty" />

    <!-- Example 2: -->TextUtils
    <s:property value="myBeanProperty" default="a default value" />
</s:push>
Example 1 prints the result of myBean's getMyBeanProperty() method.
Example 2 prints the result of myBean's getMyBeanProperty() method and if it is null, print 'a default value' instead.