The Struts Sub-Elements

 < Day Day Up > 



In this section, we discuss the sub-elements available to the top-level Struts components. Not all of these elements are used by each top-level component, but they are available to further describe each of them.

The <icon /> Sub-Element

The <icon> sub-element contains <small-icon> and <large-icon> sub-elements that can be used to graphically represent its parent element in a Struts development tool. The syntax of the <icon> sub-element is:

 <icon>   <small-icon>     path to somegraphicsfile (16x16 pixels)   </small-icon>   <large-icon>     somelargergraphicsfile (32x32 pixels)   </large-icon> </icon> 

Table 15.1 describes the properties of an <icon> element.

Table 15.1: The Attributes of an <icon> Element

Property

Description

<small-icon>

The <small-icon> sub-element contains a path, relative to the location of the Struts configuration file, naming a graphics file that contains a 16x16-pixel iconic image.

<large-icon>

The <large-icon> sub-element contains a path, relative the location of the Struts configuration file, naming a graphics file that contains a 32x32-pixel iconic image.

The following code snippets uses these <icon> sub-elements:

 <icon>   <small-icon>     /images/smalllogo.gif   </small-icon>   <large-icon>     /images/largelogo.gif   </large-icon> </icon> 

start sidebar

Note that the images referenced in these sub-elements are made strictly for Struts development and configuration tools. They are not intended for client-side display.

end sidebar

The <display-name /> Sub-Element

The <display-name> sub-element contains a short text description of its parent element for use in a Struts development tool. The syntax of the <display-name> sub-element is:

 <display-name>   short text discription of its parent element </display-name> 

The <description /> Sub-Element

The <description> sub-element contains a full-length text description of its parent element for use in a Struts development tool. The syntax of the <description> sub-element is:

 <description>   full-length text discription of its parent element </description> 

The <set-property /> Sub-Element

You can use the <set-property> sub-element to set the value of additional JavaBean properties of objects described by the <set-property> sub-element's parent. The <set-property> sub-element is commonly used to set GenericDataSource properties, extended ActionMappings, and extended global forwards. The syntax of the <set-property> sub-element is:

 <set-property   property="name of bean property"   value="value of bean property" /> 

Table 15.2 describes the attributes of a <set-property> element.

Table 15.2: The Attributes of a <set-property> Element

Property

Description

property

The property of the JavaBeans property whose setter method will be called. (required)

value

The large-icon String representation of the value to which this property will be set after suitable type conversion. (required)

Here's an example that uses the <set-property> sub-element:

 <set-property   property="driverClass"   value="org.gjt.mm.mysql.Driver" /> 

start sidebar

The <set-property> sub-element contains no body. It is configured using only its two attributes.

end sidebar



 < Day Day Up > 



Professional Jakarta Struts
Professional Jakarta Struts (Programmer to Programmer)
ISBN: 0764544373
EAN: 2147483647
Year: 2003
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net