struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject MVC 2 design, how to
Date Thu, 05 Apr 2007 23:34:53 GMT
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:

                            <------> (ActionSupport) 
veiwAccount.jsp     is the class where all the bussiness logic goes. 
AccountManager is part of the controller and based on the results it 
gets from the 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 has 
fields , accountID, accountName , ... then I need getters and setters to 
access them, but the same getters and setters has to exist in 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 and populate it from 
within .

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:
For additional commands, e-mail:

View raw message