Tag name: <tr:regionDef>
This tag, in conjunction with tr:region, allows
a common UI (a region) to be defined. Once
defined, the region must be registered in "WEB-INF/region-metadata.xml".
A registered region is referenced with the <tr:region> tag.
A region can be used
many times, either on the same page, or on multiple pages.
A single region must be defined in its own page, and
the <tr:regionDef> must be the top level tag on that page (it
replaces <f:subview>). See the <tr:region> tag to see
how a region is used (or referenced).
<tr:regionDef var="stuff" > <tr:panelHeader text="Info for Stock Symbol:#{stuff.symbol}"> <tr:inputText readOnly="true" label="Description" value="#{stuff.desc}"/> </tr:panelHeader> </tr:regionDef>
If the above is defined in "/regions/stock.jspx", then you need to register the above region in "WEB-INF/region-metadata.xml". Here's an example:
<faces-config> <component> <component-type>org.apache.myfaces.trinidaddemo.region.stock</component-type> <component-class> org.apache.myfaces.trinidad.component.UIXRegion </component-class> <component-extension> <region-jsp-ui-def>/regions/stock.jspx</region-jsp-ui-def> </component-extension> <attribute> <attribute-name>symbol</attribute-name> <attribute-class>java.lang.String</attribute-class> <attribute-extension> <required>true</required> </attribute-extension> </attribute> <attribute> <attribute-name>description</attribute-name> <attribute-class>java.lang.String</attribute-class> <default-value>Default Description</default-value> </attribute> </component> </faces-config>
And after it is registered, you can use the above region in say "master.jspx", like this:
<tr:region regionType="org.apache.myfaces.trinidaddemo.region.stock" > <f:attribute name="symbol" value="ORCL"/> <f:attribute name="desc" value="Oracle Corp"/> </tr:region>
Name | Type | Supports EL? | Description |
---|---|---|---|
var | String | Yes |
The name of the EL variable to use to reference attributes on the
parent <tr:region>. For example,
let's say this "var" attribute is set to the value "attrs";
if the <tr:region> tag has an attribute called "bar",
The value of "bar" can be referenced from a child within
<tr:regionDef> using the expression
#{attrs.bar} .
|