The ActionForm itself is a bean "in some scope". The name is whatever
you specified in struts-config.

People tend to send the options collection over seperately from the form
(your #1), since it usually a seperate query and sometimes used in more
than one place. But referring to the ActionForm itself should work as
well. You should not have to bother with a bean:define.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/


"David M. Karr" wrote:
> 
> I have an ActionForm that has a property which is a collection of beans.  I
> obtained this collection in my Action.perform() method.
> 
> In my JSP page, I want to display an html:options list where the label is one
> property of each of those beans, and the value is another property.
> 
> It appears, from the description of the attributes of "html:options", that I
> can't directly use the collection, being a property of my ActionForm, to
> directly render the options list.
> 
> It seems like I want to use the "collection" attribute of "html:options", if I
> want one property of a bean to be the label, and another to be the value.
> However, it doesn't appear as if I can specify a property of the FormBean for
> this, it just has to be a bean "in some scope".
> 
> Do I have this correct so far?
> 
> It appears that I have two choices:
> 
> 1. To not have the collection as a property of the ActionForm, but have the
> Action.perform() method manually place the collection into a property in
> request or session scope.
> 
> 2. To keep the property in the ActionForm, but do a "bean:define" in the JSP
> page to get it into a request or session scope bean.
> 
> Is this a correct assessment?
> 
> If I do the first one, should I pay attention to the "mapping.getScope()"
> value, to decide whether to put the property in "request" or "session" scope?
> 
> If these are the two basic choices, what are the design tradeoffs?  Will either
> of these "smell bad" after being utilized many times?
> 
> --
> ===================================================================
> David M. Karr          ; Best Consulting
> [EMAIL PROTECTED]   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)

Reply via email to