Can you post some of the code you are working with?

Given a method getDirectoryName() you should be able to pass the same
collection to both the labelName and labelProperty properties. 

Though, you may need to expose the collection as a bean (in page scope).
The tags are not written with the assumption that collections will be a
property of the ActionForm, but rather as a bean, usually passed with
the request.

The underlying idea being that model-based processes (like
getAllDirectories()) should be performed in an Action and the passed to
the view, rather than generated by the ActionForm (which is part of the
presentation tier).

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


Howie wrote:
> 
> ive got a little problem with html:options.  in my form bean i have a
> method called getAllDirectories() which does some processing and returns a
> java.util.List of all the available directories.  this works fine; struts
> picks up on the fact that it should look at the form bean for this
> collection.  however, html:options doesnt seem to provide for this sort of
> setup: labelName and labelProperty both report that there's "no getter
> method available for property directoryName for bean under name null."
> when combining labelName and labelProperty along with property, there's a
> servletexception thrown ( "cannot find bean under name directoryName" ).
> 
> looking at the source ( OptionsTag.java ), it seems to want everything
> nice and orderly, with both labelName and labelProperty being Collections
> used for the value and content of the <option> tag.
> 
> is there an easy way to 'bind' ( sorry, im a WebObjects refugee ) two
> different properties of a bean to the option value and option content ?
> ideally, <html:options> would, given a collection, be able to use
> PropertyUtils ( kinda reminiscent of EOKeyValueCoding in NeXT's EOF, for
> those that care about these sort of things ) to get the labelName and
> labelProperty as its iterating through.  was this the original intent ?
> 
> ---
> Howie <[EMAIL PROTECTED]>   URL: http://www.toodarkpark.org

Reply via email to