http://developer.java.sun.com/developer/restricted/patterns/BusinessDelegate
.html
http://developer.java.sun.com/developer/restricted/patterns/ValueObject.html
http://developer.java.sun.com/developer/restricted/patterns/SessionFacade.ht
ml

EJB and Struts!

-----Original Message-----
From: craigmcc@localhost [mailto:craigmcc@localhost]On Behalf Of Craig
R. McClanahan
Sent: None
To: [EMAIL PROTECTED]
Subject: RE: STRUTS and EJB




On Thu, 23 Aug 2001, Juha Paananen wrote:

>
> I also agree on that stuff that has references to STRUTS should not be
> transmitted to the EJB level. The problem here is simply that I would
> not want to make another, exactly similar (except "extends ActionForm"),
> class for transporting the information to the EJB. Of course, I can do
> that, but I don't like the idea. My question is, is this inheritance of
> ActionForm really necessary in Struts design?
>

Yes, it is ... and it is designed precisely to keep you from doing what
you're trying to do :-).

More seriously, an ActionForm exists primarily to save the server-side
state of an HTML input form, in a fashion that it can be reproduced
*exactly* the way the user entered it even if they make mistakes.  For
that reason, you will typically use String properties in an ActionForm,
even for integer and date properties in the underlying EJBs.

Further, the properties that exist on an ActionForm should match what is
on the HTML form, which is *not* always (or even often, in my experience)
exactly the same as the contents of a particular value object from a
particular EJB.

Think of an ActionForm as part of the view layer (in MVC terms), while a
value object is part of the model layer, and it will make a lot more
sense.

Craig McClanahan


Reply via email to