Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 82485 invoked from network); 5 Apr 2007 23:36:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Apr 2007 23:36:25 -0000 Received: (qmail 43325 invoked by uid 500); 5 Apr 2007 23:36:22 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 43287 invoked by uid 500); 5 Apr 2007 23:36:22 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 43276 invoked by uid 99); 5 Apr 2007 23:36:22 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Apr 2007 16:36:22 -0700 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [68.142.225.205] (HELO smtp107.rog.mail.re2.yahoo.com) (68.142.225.205) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 05 Apr 2007 16:36:13 -0700 Received: (qmail 23281 invoked from network); 5 Apr 2007 23:35:52 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:X-YMail-OSG:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=F4Bz9VXTVOjdwi60JEQ/DxxFDb9hSip2uaJv+0OH3af4mBOxX4ScbqDmrbljpG7voEGV8yurS0NO+8XkjsCgQktOVSpHb+gmG9HOVq4MKLeDpneEDysrUvatMntjRC9XGz30xzFbnMctm4jAkrN98CjAia4Tz6I7EkBhgeoWKlI= ; Received: from unknown (HELO ?192.168.1.102?) (mansour77@rogers.com@74.106.173.165 with plain) by smtp107.rog.mail.re2.yahoo.com with SMTP; 5 Apr 2007 23:35:52 -0000 X-YMail-OSG: Xz06DUAVM1mV65WtN3UjArZKOZpkVtMXz8rop7ERc8nx7uVeeZ_GCRY4j9kEJhzH1w-- Message-ID: <4615879D.8020509@yahoo.com> Date: Thu, 05 Apr 2007 20:34:53 -0300 From: mansour77@yahoo.com User-Agent: Thunderbird 1.5.0.9 (X11/20061219) MIME-Version: 1.0 To: 'Struts Users Mailing List' Subject: MVC 2 design, how to Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello every one: I am trying to write a little application to familiarize myself with struts 2. I am trying to design the application using mvc2. the application is nothing but a small utility for invoices. It store, retrieves and update invoices. Each invoice belongs to an Account in the DB. from the examples I have seen so far, the Action class is populated by values from the jsp page. So here's my design: newAccount.jsp <------> AccountManager.java (ActionSupport) <----> Account.java veiwAccount.jsp Account.java is the class where all the bussiness logic goes. AccountManager is part of the controller and based on the results it gets from the Account.java it forwards to the appropriate view. The user can view an existing account or create one through the jsp pages. Now because it doesn't make scense to populate the AccountManager with getters/setters for the same fields in Account, I will pass Account as an attribute of the request to the view. I mean, if Account.java has fields , accountID, accountName , ... then I need getters and setters to access them, but the same getters and setters has to exist in AccountManager.java so that AccountManager can communicate with the views. However, I have read some where that because the bussiness logic may contain other resources ( ie, db connection, ..) we don't pass it to the view, but we pass a minimal verion of that class as a bean. So, I 'll create another class called ActionBean.java and populate it from within Account.java . PLease note that AccountManager can be accessed from many places and depending on the output it forwards to the correct view. I need an advice or comments, as I am new to struts 2 and MVC, and I feel that I am missing something. Can any one please correct me or give me comments? --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org