Java Web project structure best practices

I am starting a new Java Web project using hibernate and standard MVC architecture

So what I really want to know is

>Does anyone know the best practice guide for Java Web project layout? > Does anyone have a specific set of hard rules for different types of projects? > Do people tend to split packages at different levels of presentation, business and application?

Solution

In order to continue my previous answer, I have many network projects In all these, the structure under SRC is more or less the same These packages are roughly divided into three logical layers

The first is the presentation layer, as you said, for servlets, application listeners, and helpers

Secondly, there is a layer for hibernate model / DB access layer The third layer of business logic However, sometimes the boundary between these layers is not clear If you are using hibernate for database access, the models are defined by hibernate classes, so I put them in the same area as Dao objects For example com. sample. Model saves hibernate data objects, com sample. model. ABCD saving objects

If you use direct JDBC (usually spring), sometimes I find it more convenient to put data objects in the business logic layer rather than the database access layer

(the rest usually belongs to the business layer)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>