Spring MVC Validation Example

Spring MVC Validation Example explains about handling the form validation in Spring MVC web application, Here we are using eclipse ide as dev environment

Spring version 4.0 provides full support for the latest Java 8 features.

Spring MVC is a popular Java Model-View-Contraller (MVC) framework. Basically spring is request based framework, which revolve around DispatcherServlet that dispatches the requests with the help of different lifecycle interfaces

Using Spring MVC, we can easily handle form validations and other error handling techniques with maximum flexibility and minimum changes.

How To Detect Device Type Using Spring

Detect Device Type Using Spring explaining about identifying the device type of a client (such as desktop, tablet or mobile) accessing your Website by using spring framework.

How to identify using Spring whether a user request is coming from Mobile/Tablet/Desktop?

For example, in your project you need to show 2 different versions of website. One is for mobile viewers and another for desktop viewers. For this you need to identify whether the request coming form a Mobile device. After detecting device type by scanning user-agents string from java HttpServletRequest. you can forward to different urls.

In our application also, we need to have this feature. Fortunately in our application using spring as dependency. By adding spring-mobile-device-1.0.1.RELEASE.jar, we could able to achieve what we want

Detect user is from Mobile/Tablet/Desktop Using Spring Framework?

In this example we are identifying the device type such as desktop, tablet or mobile of client accessing your Website.

Spring MVC 4 Autowire Example

Spring MVC 4 Autowire Example shows a real time implementation of autowiring a bean to required service.

Spring @Autowired annotation is used for autowiring a bean to constructor, setter method, property or methods.

Following are the different ways we can do autowire feature

  1. Auto-Wiring "no" -> This is default mode means no autowiring
  2. Auto-Wiring "byName" -> This means autowiring happens using the matching property name
  3. Auto-Wiring "byType" -> This means autowiring happens using the matching type
  4. Auto-Wiring "constructor" -> This means autowiring happens through constructor according to the exact arguments

Spring MVC 4 Example

Spring MVC 4 Example explains step by step example of configuring Spring MVC with eclipse

Spring version 4.0 provides full support for the latest Java 8 features.

Spring MVC is a popular Java Model-View-Contraller (MVC) framework. Basically spring is request based framework, which revolve around DispatcherServlet that dispatches the requests with the help of different lifecycle interfaces

Spring MVC have following important interfaces to handle a request during the execution phases of a HTTP request.

  • HandlerMapping
  • HandlerAdapter
  • Controller
  • View
  • ViewResolver
  • HandlerInterceptor
  • LocaleResolver
  • MultipartResolver

Spring MVC 4 REST Example

Spring MVC 4 REST Example explains about creating a simple Spring MVC REST service using eclipse.

In this example we are using Jackson JSON API for returning JSON response according to the request

Now a days more and more deployment is going based on restful services compare to WSDL Webservices, due to the weights towards the simplicity of configuration

You can see the below example, which is demonstrating How to create a Spring Restful service using MVC 4

Spring Jdbc Template

Spring Jdbc Template Example explains step by step details of configuring Spring Jdbc Template

The Spring Framework is a free and open source framework using for the development of java enterprise applications

Spring framework consists of several different modules including Aspect Oriented Programming, Inversion Control, Model View Controller, Data Access, Transaction Management, Batch Processing, Remote Access & Spring JDBC Template will really ease the development effort of coding team.

SpringJdbcTemplate is a module available in spring core framework, which will help you to persist entities by using very little code, it simplifies the creation of database connection & closing connection etc.

In this example, we are injecting the DataSource by setter injection, if you need you can configure using spring configuration.

Spring Tutorial

Spring Tutorial explains step by step details of setting / configuring Spring with Eclipse

The Spring Framework is a free and open source framework using for the development of java enterprise applications

Spring framework consists of several different modules including Aspect Oriented Programming, Inversion Control, Model View Controller, Data Access, Transaction Management, Batch Processing, Remote Access & Spring JDBC Template will really ease the development effort of coding team.

In this example you will learn how to set / injects a bean property via setter injection using spring framework.