Alex Rivera | Logout

Describe the architecture you use for Java web applications?

Asked 2008-11-13T12:55:32.957
148

Let's share Java based web application architectures!

There are lots of different architectures for web applications which are to be implemented using Java. The answers to this question may serve as a library of various web application designs with their pros and cons. While I realize that the answers will be subjective, let's try to be as objective as we can and motivate the pros and cons we list.

Use the detail level you prefer for describing your architecture. For your answer to be of any value you'll at least have to describe the major technologies and ideas used in the architecture you describe. And last but not least, when should we use your architecture?

I'll start...


Overview of the architecture

We use a 3-tier architecture based on open standards from Sun like Java EE, Java Persistence API, Servlet and Java Server Pages.

  • Persistence
  • Business
  • Presentation

The possible communication flows between the layers are represented by:

Persistence <-> Business <-> Presentation

Which for example means that the presentation layer never calls or performs persistence operations, it always does it through the business layer. This architecture is meant to fulfill the demands of a high availability web application.

Persistence

Performs create, read, update and delete (CRUD) persistence operations. In our case we are using (Java Persistence API) JPA and we currently use Hibernate as our persistence provider and use its EntityManager.

This layer is divided into multiple classes, where each

Edit
Report

2 Answers

21

Ok I'll do a (shorter) one:

  • Frontend : Tapestry (3 for older projects, 5 for newer projects)
  • Business layer: Spring
  • DAO's : Ibatis
  • Database : Oracle

We use Sping transaction support, and start transactions upon entering the service layer, propagating down to the DAO call's. The Service layer has the most bussines model knowledge, and the DAO's do relatively simple CRUD work.

Some more complicated query stuff is handled by more complicated queries in the backend for performance reasons.

Advantages of using Spring in our case is that we can have country/language dependant instances, which are behind a Spring Proxy class. Based on the user in the session, the correct country/language implementation is used when doing a call.

Transaction management is nearly transparent, rollback on runtime exceptions. We use unchecked exceptions as much as possible. We used to do checked exceptions, but with the introduction of Spring I see the benefits of unchecked exceptions, only handling exceptions when you can. It avoids a lot of boilerplate "catch/rethrow" or "throws" stuff.

Sorry it's shorter than your post, hope you find this interesting...

answered 2008-11-13T13:24:36.347
19

Ideal Java Based Web Development Technologies Today.

Web Layer :

HTML+CSS+Ajax+JQuery

RESTFul Web Controller/Action/Request Processing Layer :

Play Framework

Business Logic/Service Layer:

Use Pure Java Code as long as possible. One can do fusion of web services here.

XML/JSon Data Transformation Layer :

XMLTool(Search On Google Code),JSoup,Google GSon,XStream,JOOX (Search On Google Code)

Persistence Layer :

CRUD : JPA or SienaProject or QueryDSL / Complex Queries : JOOQ,QueryDSL

answered 2011-08-22T12:08:54.447

Your Answer