Mansour wrote:
Hello Every one:
I have been working on a small application for few days. Just to learn by doing, how Struts 2 works, and how to design applications for struts 2. My little app is a small billing system to store invoices for accounts. Each Service (object) belongs to an Invoice which belongs to an Account. The application retrieves this info from the DB for display or update.

Now my question is, how do I design this app? do I create many actions and many views ? what about the business logic ? If I create a class called Accout that populate the account info from the DB and encapsulated all the functionality in it, then I can not pass it to the view, since it has the DB connection. So, I created another class called AccountBean which holds only the data that I need to view. What If I want to update the account? The first idea that came to my head is to pass back the AccountBean to Account, where it will be populated again with the values and a new DB connection will be created ... but it doesn't really sound very cool.

Someone have pointed to me in a previous post to use ModelDriven ! This will just make the learning curve steeper. On the other hand, I couldn't find any documentation for this approach. Is there a tutorial about how to design app that will work with struts? I assumed (since its purpose is to separate the business Logic form the Presentation) that I design the app as if it was for any thing else ( desktop app) so I have the three mentioned classes (Account , Invoice, Service) plus some support classes (DataBaseAdapter ) that is not related to struts classes either. And I don't know if that's right.

thanks in Advance.



OK I haven' get any response which means I don't have enough details.
I have 3 classes Account.java, Invoice and Service. I need to be able to retrieve account and add Invoice or Service and update them as well. I dont want to send the whole Account object to the webpage. So I put it in AccountBean, and set it through the GetAccountAction. Now, If I need to add an Invoice to this object, I need the Account object back. So do I pass the whole AccountBean back to the original Account object to perform this functionality ?





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to