aspose file tools*
The moose likes Java in General and the fly likes best MVC model with correct package structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "best MVC model with correct package structure" Watch "best MVC model with correct package structure" New topic
Author

best MVC model with correct package structure

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Suppose I am developing a simple jsp-servlet application for manage customer information. So i want to know what would be the best package structure and how controllers should be there in this case.

So the main actions would be insert, edit, delete and view customers in this case.

I thought of having a one controller called MainController for identify those 4 actions.
Or else should i need to have 4 controllers for each action?

One DAO class called CustomerDao for manage all database related stuff

One DTO class called Customer for transfer customer data and Util class for common actions

But i am confuse here what should i need to have under domain. Does under domain where the business logic should reside. Though this application is simple enough, is it correct to have class for example like ManageCustomer which call the necessary DAO action. The controller shouldn't need to directly call the DAO right? It should go across domain and domain access DAO right. I am correct here?

But what i believe correct is that business related logic's belongs to a class under a package something like service right? If so what should domain classes do?

So currently i have below packages,

test.controller
-MainController
test1.dao
-CustomerDao
test1.domain
-??
test1.dto
-Customer
test1.util
DBUtil


Please help me to clear this out and to get know a best practice approach for this kind of a project or more advanced one?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: best MVC model with correct package structure