Chris Wilson wrote:

> > From: Martin Cooper [mailto:[EMAIL PROTECTED]]
> [snip]
> > One interesting point that I discovered on my trails through the code is
> > that the "type" attribute on the logic:iterate tag does not appear to be
> > used at all. It certainly isn't taken into account when
> > bean:write is doing
> > its thing. This actually makes sense when you think about it - the
> > logic:iterate tag just puts a bean into the requested scope, and
> > it's up to
> > the retriever (in this case, bean:write) to decide what type it is.
>
> why is the type attribute even in the iterate tag then?  just curious...
>

Check out the org.apache.struts.taglib.logic.IterateTei class -- you will see
that the "type" attribute is used to define the Java data type of the scripting
variable that is exposed to the page.  This does not generally matter if you
only access the exposed bean with custom tags, but does matter if you try to
access it with scriptlets -- the default data type is java.lang.Object, so you
would have to cast all your method calls.

The same general pattern is followed in other places where the "type" attribute
is used for the same purpose, such as <bean:define>.

Craig


Reply via email to