ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzatz_5.4.0.1/51/program/jspget.htm

53 lines
3.1 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>&lt;tsx:getProperty&gt;</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h5><a name="jspget"></a>&lt;tsx:getProperty&gt;</h5>
<p>The &lt;tsx:getProperty&gt; tag gets the value of a bean to display in a JavaServer Pages (JSP) file.</p>
<p>The &lt;tsx:getProperty&gt; is an IBM extension of the Sun Microsystems &lt;jsp:getProperty&gt; tag. The IBM extension implements all of the &lt;jsp:getProperty&gt; function and adds the ability to introspect a database bean that was created using the IBM extension &lt;tsx:dbquery&gt; or &lt;tsx:dbmodify&gt; tag.</p>
<p>The &lt;tsx:getProperty&gt; uses the query results object (for the &lt;tsx:dbquery&gt; syntax whose identifier is specified by the &lt;tsx:getProperty&gt; bean attribute) and the appropriate column name (specified by the &lt;tsx:getProperty&gt; property attribute) to retrieve the value.</p>
<p><strong>Note:</strong> You cannot assign the value from the &lt;tsx:getProperty&gt; tag to a variable. The value, generated as output from this tag, is displayed in the browser window.</p>
<p>The &lt;tsx:getProperty&gt; syntax is:</p>
<pre>&lt;tsx:getProperty name=&quot;<em>bean_name</em>&quot; property=&quot;<em>property_name</em>&quot; /&gt;</pre>
<p>This list describes the attributes and their values:</p>
<ul>
<li><p><strong>name</strong>
<br>The name of the bean declared by the <tt>id</tt> attribute of a &lt;tsx:dbquery&gt; syntax within the JSP file. See <a href="jspqry.htm">&lt;tsx:dbquery&gt;</a> for more information. The value of this attribute is case-sensitive.</p></li>
<li><p><strong>property</strong>
<br>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.</p></li>
</ul>
<p><strong>>Examples</strong></p>
<pre>&lt;tsx:getProperty name=&quot;userProfile&quot; property=&quot;username&quot; /&gt;
&lt;tsx:getProperty name=&quot;request&quot; property=request.getParameter(&quot;corporation&quot;) /&gt;</pre>
<p>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 (subproperty), 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 <a href="jsprpt.htm">&lt;tsx:repeat&gt;</a>.</p>
<p>Some examples of using the full form of the property attribute:</p>
<pre>&lt;tsx:getProperty name=&quot;staffQuery&quot; property=address(currentAddressIndex) /&gt;
&lt;tsx:getProperty name=&quot;shoppingCart&quot; property=items(4).price /&gt;
&lt;tsx:getProperty name=&quot;fooBean&quot; property=foo(2).bat(3).boo.far /&gt;</pre>
</body>
</html>