This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • property
Skip to end of metadata
Go to start of metadata

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

Dynamic Attributes Allowed:

false
 

Name

Required

Default

Evaluated

Type

Description

default false false String The default value to be used if value attribute is null
escapeCsv false false false Boolean Whether to escape CSV (useful to escape a value for a column)
escapeHtml false true false Boolean Whether to escape HTML
escapeJavaScript false false false Boolean Whether to escape Javascript
escapeXml false false false Boolean Whether to escape XML
value false <top of stack> false Object Value to be displayed

Examples

Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'

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

    <!-- Example 2: -->TextUtils
    <s:property value="myBeanProperty" default="a default value" />
</s:push>

Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'
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.
  • No labels

1 Comment

  1. Hi,

    are the mentioned parameters correct? I'm using Struts 2.1.8 and the only parameters available are

    • default
    • escape
    • escapeJavaScript and
    • value

    This very much seems to be a documentation issue as this page was last updated in 2007!?

    Regards