Hello everyone,

I also agree...

We also use struts in J2EE apps with and make use of the Value Object
pattern. (http://www.tstrata.trysoft.com)

We assign the VO as a member of the ActionForm.  If we want to abstract the
VO, we add accessor methods to the Form as Dmitri has explained...  these
are all fairly well recognised design patterns.

You definately DON'T want to pass struts concepts into your business layer
(EJB's)!

Maybe it's time for a sample application using struts and EJB's... based on
JBoss perhaps... something that showcases EJB/Struts design patterns.  Is
there one already?

Matt O'Haire
Trysoft Corporation Ltd.
http://www.trysoft.com


-----Original Message-----
From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 23, 2001 08:35
To: Struts Users Mailing List
Cc: '[EMAIL PROTECTED]'
Subject: RE: Design question - Action Form vs Business Delegates/Value
Objects


Hi,

I also agree with Michelle...

I think what you are thinking is maybe you could use the struts form _as_
the value object?  imho this would be bad design, as the whole idea of
putting the logic in a separate tier is to have it not bound to any one
form of presentation.  What Michelle is suggesting though, is something
like:

public class EmployeeForm extends ActionForm
{
  private EmployeeVO vo = new EmployeeVO();

  public String getName()
  {
    return vo.getName();
  }

  public void setName(String name)
  { 
    vo.setName(name);
  }

  // and so on....

  // get the vo
  public EmployeeVO getEmployeeVO()
  { 
    return vo;
  }
}

so say you have an action class:

public class AddEmployeeAction()
{
  public void perform( ... )
  { 
    EmployeeForm eform = (EmployeeForm) form;
    employeeManager.add(eform.getEmployeeVO());
  }
}

etc... very simplified example, but hopefully this is a bit clearer... I
use this all the time, and would be interested to hear what other ppl
think as well...

cheers
dim

Reply via email to