struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject RE: STRUTS and EJB
Date Mon, 27 Aug 2001 23:51:51 GMT

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

Craig McClanahan

View raw message