Programsji's Spring Tutorials

Hello World(Spring MVC)

Spring Hello World

In this hello world tutorial, we are going to learn these Spring terms.
(1)configuration Files
(2)@Controller & @RequestMapping Annotations
(3)Model
(4)ViewResolver
(5)Send data from Controller to view(jsp)
(6)web.xml

Common Tags(Spring MVC)

Spring Common Tags Example

In this tutorial, we are going to learn about most commons spring MVC tags. Some are:
(1)<s:form />
(2)<s:input />
(3)<s:checkbox />
(4)<s:checkboxes />
(5)<s:radiobutton />
(6)<s:hidden />
(7)<s:select />

Pathvariable(Spring MVC)

Spring Path Variable Example

@PathVariable annotation can be used to accept the dynamic parameters in the request path. Lets see this example in detail...

Requestparam(Spring MVC)

Spring Requestparam Example

@RequestParam annotation can be used to bind the Url's QueryString parameter to a variable in method.

MultiAction(Spring MVC)

Spring Multiaction Example

Here we will learn ,how to map urls to methods.In this program, we are going to create multiple controllers , then multiple methods in each controllers, and multiple urls to map to those methods. Lets see…

CRUD(Spring MVC)

Spring CRUD Example

(Create, Retrieved, Update, Delete), this is the most widely used program. In this program, we are going to learn following terms
(1) Database connection
(2) Hibernate with Spring
(3) HQL
(4)Multiple Actions in Single Controller.
Let’s start ...

Ajax(Spring MVC)

Spring Ajax Example

An application to demonstrate to use Ajax in Spring application. In this example, we are going to learn about prerequisites to use ajax in spring, as well as usage of @Responsebody to map an object to httpResponse.

Converter(Spring MVC)

Spring Converter Example

Converters are used to Convert http messages into some usable form, for example, to convert json message into a bean (or vise versa), we use MappingJacksonHttpMessageConverter. In this example, we are going to create our own converter to convert a String type request parameter to Person type Object.

Interceptor(Spring MVC)

Spring Interceptor Example

Interceptors (1) intercepts an incoming http request before it reaches to mapped method. and
(2) Intercepts the outgoing response after it leaves the controller but before sending response to browser. Lets see this example to understand its working....

Exception Handling(Spring MVC)

Spring Exception Handling Example

In Spring, we can create a common method to handle exceptions for all methods of same controller. Lets have a look at this program…

Global Exception Handling(Spring MVC)

Spring Global Exception Handling Example

In this example, we are going to learn as how to create own Exception handler to handle different kinds of exceptions.

Validation Using Annotation(Spring MVC)

Spring Validation Using Annotation Example

To validate all request parameters, we can use annotations like @NotNull,@Length, @Range etc. Lets see this example in more detail to learn validation using annotations

Validation Using Validator(Spring MVC)

Spring Validation Using Validator Example

Spring offers us validator interface, that can be used to create custom validator class to validate request data.

Spring With Tiles(Spring MVC)

Spring with Tiles

If In an application multiple views share common header/footer, then it is a good idea to use tiles. Tiles offers us functionality to use same header/footer/menu for multiple pages. To use tiles in our application, it is necessary to have tiles dependency in pom.xml file. Lets learn this example line by line.

Upload a file(Spring MVC)

Upload a file

In this example, we are going to learn functionality to upload a file. we will see the basic prerequisites and configurations needed to add such functionality in application.

Download a file(Spring MVC)

Download a file

It is very common in application to add functionality to download a file. Here we are going to learn to add file download functionality.

Locale(Spring MVC)

Locale

for a multilingual application, It is necessary to add functionality to change all messages/labels according to user's locale. In this tutorial, we are going to learn as how to implement this functionality in our application.

Send a Mail(Spring MVC)

Spring Send a Mail Example

In this program, we are going to implement mail sending functionality. We are using gmail domain to send a mail. Lets have a look at this program.