On Tue, 10 Jul 2001, Ted Husted wrote:

> 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.

actually, getAllDirectories() returned a List of objects that responded to
getDirectoryID() and getDirectoryName().  apparently html:options didnt
like that, so the main page of the application now redirects to an action.
the action now goes out and fetches this data, putting it into the request
before forwarding it off to another page/action/forwarder.  now im just
doing a normal logic:iterate through the array and its all working.

> 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).

i just kept forgetting that the JSP pages are compiled into servlets.  in
WebObjects, you'd have a WOComponent subclass and 2-3 files corresponding
to that subclass: a .html file, a .wod file, and a .woo.  the .wod told
the .html how to interact with the .java, and the .woo was used for misc
DB initialization purposes.  i just have to wrap my head around this new
view-is-actually-a-class concept :)

>
> -- 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
>


---
Howie <[EMAIL PROTECTED]>   URL: http://www.toodarkpark.org
     "This sort of thing has cropped up before and has always been
      due to human error." -- HAL


Reply via email to