Architecture
What is an architecture ?
Wikipedia defines it as beeing
the structure or structures of the system. What I like about this definition is the plural on
structures.
Too many companies see the
Architecture with a upper
A instead of seeing architecture
S with a upper
S. It's dangerous to try to homogenise all the projects of a company into a single defined architecture. Each project is different, each project has it's own needs. If you need to develop a simple web administration console used by one person twice a week, JSPs + SQL statements are fine. You would loose time, money and effort trying to homogenise this application into a defined 3-tier architecture.
Java EE 6 is rich and simple enough to be used by any kind of application. Need simple ? Do simple ! Need rich ? Add layers and components.
Structure
Any architecture has one or many layers. Each layer has a certain amount of components that could be used.
- View : On the view layer, you can have any kind of graphical user interface. It goes from basic JSP, JSF pages or Swing. You could also think of others non-Java EE 6 technologies such as GWT, JavaFX or Flex
- Controller : Web controllers have been implemented through Servlets, but with JSF, a Managed Bean can also be seen as a controller
- Service : A service is a component that gives you a service. In Java EE 6 it is primarely a stateless session bean, but it's anything from a simple POJO, a Web Service, a Restful Service, a Stateful EJB, a Message driven bean...
- Domain : Layer of business classes.
- Database Access : For database access and Object/Relational mapping, JPA is the preferred persistent model in Java EE 6. But you can still use pure JDBC access or even DAOs.
- Interoperability : Your system can either use external services or expose a set of services.
JSP and JDBC application

Some people would call that a
quick and dirty application. They might be right, but they also might be wrong. In certain cases you just need a set of JSP pages with direct database access using JDBC result sets. It can be used for prototyping, but also for some non-critical non-concurrent application.
A simple MVC Web application

If you don't want to use JSF for your web application, you still have the choice to use the good old MVC I model : JSPs talking to Servlets that use DAOs for accessing the database and POJOs as the model. Servlets also manage the flow of your application.
The preferred simple web application

To write a simple but robust web application in Java EE 6, nothing easier than JSF, EJBs and JPA.
A back-end Restful application
Distributed enterprise application
Comments: 0