Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@jakarta.apache.org Received: (qmail 4062 invoked by uid 500); 27 Aug 2001 23:52:12 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: struts-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 4053 invoked from network); 27 Aug 2001 23:52:12 -0000 Received: from icarus.apache.org (64.125.133.21) by daedalus.apache.org with SMTP; 27 Aug 2001 23:52:12 -0000 Received: (qmail 87481 invoked by uid 1059); 27 Aug 2001 23:51:52 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 27 Aug 2001 23:51:52 -0000 Date: Mon, 27 Aug 2001 16:51:51 -0700 (PDT) From: "Craig R. McClanahan" Sender: To: Subject: RE: STRUTS and EJB In-Reply-To: Message-ID: <20010827164630.P82011-100000@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: localhost 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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