page Use the value of this attribute as a context-relative URI, and generate a server-relative URI by including the context path. The forward tag is responsible for either redirecting or forwarding to a specified global ActionForward. The forward tag has one attribute, name, which is the logical name of the ActionForward from the configuration file. 8.5.4 Collection Utilities One of the most useful and most widely used tags within the Struts tag libraries is the iterate tag. The iterate tag is responsible for executing its body content once for every element inside the specified collection. It has one required attribute: id The name of a page-scope JSP bean that will contain the current element during an iteration. An example is the best way to understand how to use the iterate tag: Here, the iterate tag will get the collection of addresses by calling the getAddresses( ) method on the userSummary bean. During each iteration, an individual address will be assigned to the address variable. This variable can be used inside the body of the iterate tag as if you had assigned it directly. During the next iteration, the next address object will be assigned to the address variable. This continues until the entire collection of addresses has been traversed. The iterate tag is very flexible in terms of where it gets the collection to iterate over. The attributes that control how the iterate tag performs this behavior are listed in Table 8-7. Table 8-7. Attributes of the iterate tag Name Description collectionA runtime expression that evaluates to a collection (conforming to the requirements listed above) to be iterated over. id The name of a page-scope JSP bean that will contain the current element of the collection on each iteration, if it is not null. indexed The name of a page-scope JSP bean that will contain the current index of the collection on each iteration. length The maximum number of entries (from the underlying collection) to be iterated through on this page. This can be either an integer that directly expresses the desired value, or the name of a JSP bean (in any scope) of type java.lang.Integerthat defines the desired value. If not present, there is no limit on the number of
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.
This entry was posted
on Friday, July 20th, 2007 at 7:23 pm and is filed under Domain.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.