user123
user123

Reputation: 5407

layer structure in spring MVC

Here is my Spring MVC file structure. I wanted to know which file belongs to which layer i.e. Presentation layer (I thinks .jsp files) , Business layer , Logic layer Edit: Database layer layer structure

So here which file belongs to which layer and any description about how that file add to layer will help me a lot.

When I learned Spring MVC from internet articles, they were using this short of packages. I appreciate if someone describe uniqueness of each package.

Upvotes: 1

Views: 1405

Answers (1)

Nikhil Talreja
Nikhil Talreja

Reputation: 2774

As you guessed correctly, the .jsp files are your Presentation Layer that handle how your data would look like.

Business Layer is where you write the business logic of your program. In your application, there does not seem to be any package that is doing this. The classes in this layer are usually Plain Old Java Objects (POJOs)

I am not sure what exactly you mean by Logic Layer because it seems to be same as Business layer.

There is another layer called the Data Access Layer which seems more evident in your application.

Package structure:

  • *.controller - Contains controller classes which handle URL mappings to specific views
  • *.dto - Data Transfer Object (DTO) are the objects that correspond to your DB tables and that help in implementing ORM
  • *.dao - Data Access Object (DAO) provide an interface to interact with your DB using the DTOs
  • *.doaImpl - Give concrete implementations of the DAOs
  • .jdbc - This package seems to be a utility class package used to create and manage JDBC connections
  • *.delegate - Are delegate packages which may perform one or more business functions using the delegation-pattern

Upvotes: 3

Related Questions