In the constructor of your ActionForm, you can say someBean = new
SomeBean();  Or you can just initialize the bean in its declaration, i.e.
        private SomeBean someBean = new SomeBean();

This will work fine, unless SomeBean is an interface.  It would be nice to
be able to dynamically configure the implementation of embedded beans.
Unfortunately, Struts does not yet support such a feature.

-----Original Message-----
From: Mike D [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 09, 2001 11:07 AM
To: [EMAIL PROTECTED]
Subject: data beans and ActionForm


if I have a separate data bean, which is a property in the ActionForm, how 
do I initialise that bean? I.e.:

ActionForm someActFrm {

  private SomeBean someBean = null;

  public SomeBean getSomeBean () {
    ...
  }
  public void setSomeBean (SomeBean someBean) {
    this.someBean = someBean;
  }
  public void setName(String someString) {
    someBean.setName(someString);
  }
}

how and where do I create an instance of the bean, so that I have a bean in 
the form, rather than it being null all the time...

Will be greatful for any help!

Mike

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Reply via email to