On 7/16/05, Laurie Harper <[EMAIL PROTECTED]> wrote:
> 
> 1) Given that FormDef is using DynaBeans / DynaForms under the covers, am I
> right in assuming that form properties would need to be accessed with
> expressings like ${EmployeeForm.map['address'].map['city']} outside of
> Struts tags and similar BeanUtils aware contexts?

Yes.


> The problem is, I don't do pre-population of forms: I rely on Struts to
> instantiate the form bean an put it in scope (which I'm pretty sure is
> request, not session, scope). 

Actually, you'll have to specify request scope explicitly when you map
your action.


> I then fill the form in using a JSP tag if
> necessary (i.e. the first time the form is displayed, I call a tag to
> populate it).
> 
> So will the techniques described in the article work with this scheme?

It probably won't.  For one thing, the FormDef set/getFormUtils
methods need resources available to the Action object, such as the
ActionMapping.


> > FormDef can also support a collection of nested form beans, though I
> > haven't had the time to write up an article for that.  Some
> > explanation for it has been provided in the FormDef user list though:
> > https://formdef.dev.java.net/servlets/BrowseList?list=users&by=thread&from=230908
> 
> Again based on the article, am I right in thinking that I have to write
> code to use this feature (i.e. it's not purely form definition based)?

Yes, but it's pretty much just you specifying what collection you want
to use, specified in a converter class you'll need to implement.

public class MyListConverter extends FormCollectionConverter {

    public Collection getFormCollection(ConversionContext context,
                                                 String propertyName,
                                                 Collection source) {
        return new ArrayList();  // replace with whatever List class
you need in your forms
    }

    public Collection getBeanCollection(ConversionContext context,
                                                 String propertyName,
                                                 Collection source) {
        return new ArrayList();  // replace with whatever List class
you need in your beans
    }

}


Hubert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to