mvc

Spring Architecture – An Introduction:Spring is a lightweight framework used to build java applications. In this article let us see the Spring Architecture in detail.

There are seven modules in Spring,

Core

ORM

DAO

AOP

MVC

Application Context

Web Context

CORE:This forms the base of Spring framework. All the other modules are built over Core module. This module contains Bean factory container which forms the basis to implement Dependency Injection.

DAO:Data Access Object – This module provides a standard way for data access. (Hibernate, JDBC etc..). Normally in an application to access the database we need to opening connection, perform the operation and close the connection. But in Spring DAO, We can overcome this issue’s because Spring takes care of opening and closing of database connections and all we have to do write code to perform the operations.

ORM:Object Relational Mapping – This helps us to integrate Spring framework with other Frameworks such as Hibernate, JDO etc.

MVC:Model View Controller – This module helps us to separate application logic from the view.

Application Context:This module is built over Core Module. Application Context has all the concepts of Bean factory and in addition to those concepts application context has internalization of Messages, life cycle events and validation

Web Context:Web Context is a part of web application which includes MVC module.

Let us see an example code today for Spring MVC that has multiple submit buttons in one form. This is Second spring mvc tutotial. (Spring MVC example1 is here).

In this example, We are going to have 2 submit buttons. “Success” and “Failure”. When user clicks “Success” button it should pass to Controller and do some functions and take the user to respective page. Similarly when user clicks “Failure” it should go to Controller and then pass it to respective page.