InfoCenter Home >
4: Developing applications >
4.2: Building Web applications >
4.2.2: Developing JSP files >
4.2.2.3: Overview of JSP file content >
4.2.2.3.7: IBM extensions to JSP syntax >
4.2.2.3.7.1: JSP syntax: Tags for variable data >
4.2.2.3.7.1.1: JSP syntax: <tsx:getProperty> tag syntax and examples

4.2.2.3.7.1.1: JSP syntax: <tsx:getProperty> tag syntax and examples

<tsx:getProperty name="bean_name"
property="property_name" />
where:
  • name

    The name of the JavaBean declared by the id attribute of a <tsx:dbquery> syntax within the JSP file. See <tsx:dbquery> for an explanation. The value of this attribute is case-sensitive.

  • property

    The property of the bean to access for substitution. The value of the attribute is case-sensitive and is the locale-independent name of the property.

Examples

<tsx:getProperty name="userProfile" property="username" />
<tsx:getProperty name="request" property=request.getParameter("corporation") />

In most cases, the value of the property attribute will be just the property name. However, to access the request bean or access a property of a property (sub-property), you specify the full form of the property attribute. The full form also gives you the option to specify an index for indexed properties. The optional index can be a constant (such as 2) or an index like the one described in <tsx:repeat>. Some examples of using the full form of the property attribute:

<tsx:getProperty name="staffQuery" property=address(currentAddressIndex) />
<tsx:getProperty name="shoppingCart" property=items(4).price />
<tsx:getProperty name="fooBean" property=foo(2).bat(3).boo.far />

Go to previous article: JSP syntax: Tags for variable data Go to next article: JSP  syntax: <tsx:repeat> tag syntax

 

 
Go to previous article: JSP syntax: Tags for variable data Go to next article: JSP  syntax: <tsx:repeat> tag syntax