A look at MVC frameworks

MVC frameworks provide limited functionality when compared to ZK, Echo and other Java Web frameworks.

Read time 2min 50sec

In the previous Industry Insight in this series, I looked at ZK and Echo and began looking at component-based frameworks. In this, the third article, I will consider MVC frameworks.

General description:

These frameworks all work in essentially the same way, by implementing the popular Model, View and Controller pattern. The front-end typically uses JSP, so the separation between presentation and logic depends on a disciplined development approach. MVC frameworks tend to focus on binding to the front-end, performing validation, and resolving request views and controllers.

They also tend to rely heavily on configuration, with the controllers typically implemented as Pojos and the views being simple JSPs with custom tag libraries, although recently a trend has developed to use convention over configuration.

These frameworks provide limited functionality when compared to the frameworks looked at in the previous two sections; in fact some of the frameworks already discussed include a full MVC in addition to the rest of their functionality.


Spring MVC, Struts 2


* Uses a well-known approach.
* Flexible.
* Plumbing code usually configured with XML or annotations, or more recently by coding by convention.
* Widely used in production systems.


* Does not provide elaborate component libraries.
* All Ajax done by JavaScript or third-party libraries.
* Requires much configuration.
* Limited functionality makes these frameworks the first step above plain JSPs and servlets.

When to use these frameworks:

* For fairly simple front-end requirements.
* If you have an existing system and want to add the binding and flow control functionality that MVC provides.
* If already using Spring throughout your system, using Spring MVC could be a natural choice.

Spring MVC

This is possibly the most widely used MVC framework, largely due to the success of the Spring framework with which it comes bundled. Like Spring, this MVC is non-intrusive, with the configuration located in Spring context files. Alternatively, annotations can be used, and from 2.5 many coding convention-based configurations have been introduced.

If already using Spring throughout your system, using Spring MVC could be a natural choice.

Andre van der Schyff is a senior developer at DVT.

The framework provides simple but powerful URL mapping mechanisms to map requests to controllers. The controllers can extend Spring controller classes, or be configured as Pojos. For the front-end, the framework uses JSP with a Spring MVC tag library for form binding, but a variety of views can be used such as Freemarker, Velocity, or JasperReports.

Since this MVC is bundled with Spring, it can form part of a complete application similar to Seam but without requiring a J2EE container. In the tradition of Spring, it integrates with many different technologies including other MVCs (Struts), various view technologies, Spring Security, and any service layer that Spring can be integrated with.


* Customisable, powerful binding and validation.
* Non-intrusive.
* Customisable locale and theme resolution.
* Powerful configuration capabilities using Spring application contexts.
* Part of the Spring framework.


* Works best with JSP as the front-end.
* Provides a simple MVC and not much else.
* Requires a lot of configuration.

In the next, final Industry Insight, I will look at other frameworks and factors to consider when choosing a Java Web framework.

* Andre van der Schyff is a senior developer at DVT.

Andre van der Schyff
Senior developer at DVT.

Andre van der Schyff has been a senior developer at jCentric for the past three years, consulting to TradeStream as a senior developer and team lead, developing supply chain management solutions. He has come to specialise in creating rich client and Web-based enterprise systems using open frameworks such as Spring and Hibernate, employing agile development methodologies such as XP. Prior to that, Van der Schyff worked on Java programming projects for various corporations after teaching a Java course at Hatfield Business College in 2001 on behalf of employer Telkom. The telco then moved Van der Schyff to his first enterprise Java project developing a new online billing system. That work experience coincided with his studies through the University of South Africa (Unisa), where he completed a BSc (Hons) Information Systems in 2004, after becoming a Sun Certified Java Programmer in 2002 and completing his graduate degree at the University of Pretoria in 2000.

Have your say
Facebook icon
Youtube play icon