Advantages of using Spring MVC for developing websites

Spring is one of the most used tools to create Java web portals. However, many programmers avoid using it because they don’t know its advantages. Let’s see some of them:

Simple configuration files

Everything can be configured with xml files, even advanced options like the connection to the database, authentication using LDAP or the method that is executed when an user logs in successfully.

Fast development of forms

One of the most tedious tasks is the programming of forms because there are actions that are repeated in most of them like checking that data has valid values, displaying errors …  Spring handles this and has JSP tags for binding the elements of the form.

Web flow management

Most web sites have sequences of actions that can be performed in order to get a result. For example, to buy a flight, you will select the day and time, then select the seats, provide payment details … Spring WebFlow allows to specify the possible states and transitions between them in XML files, so developers can focus on programming features such as payment processing.

Integrated MVC pattern

Spring has special annotations for MVC that allows to separate code in groups like services or repositories, and makes it easier to load and test them using dependency injection. And it is easy to map the urls to the classes that do the functionalities using Controllers and automatically serialize the data before sending them to the views.

Use of annotations

It includes many annotations that reduce the code that is needed to do typical actions. For example, @RequestMapping maps an url address to a method instead of defining a a servlet and configuring it in the web.xml file.

I hope that now you feel encouraged to work with it.

Rafael Borrego

Consultant and security champion specialised in Java, with experience in architecture and team management in both startups and big corporations.

Disclaimer: the posts are based on my own experience and may not reflect the views of my current or any previous employer

Facebook Twitter LinkedIn 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>