struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: iterate needs "class" attribute
Date Fri, 23 Mar 2001 18:12:54 GMT


On Fri, 23 Mar 2001, Taylor Cowan wrote:

> The iterate tag is similar to a <jsp:useBean tag...> in that it introduces a
> new scripting var.  It would be nice to have the <iterate> tag type cast the
> values from the iterator.
> 
> Taylor Cowan
> 
> 

You can indeed specify the type of the scripting variable that is exposed:

<logic:iterate id="customer" name="customers"
 type="com.mycompany.mypackage.CustomerBean">
  ... here, "customer" will be of class MyCustomerBean ...
  Customer name is <%= customer.getName() %>.
</logic:iterate>

For most uses by Struts tags, this doesn't matter -- they will happily use
reflection to access properties from any object type.

Craig



Mime
View raw message