background preloader

Spring Framework

Facebook Twitter

Ghillert/atmosphere-spring-web-mvc - GitHub. Bootstrapping a web application with Spring 3.1 and Java based Configuration, part 1. Building a RESTful Web Service with Spring 3.1 and Java based Configuration, part 2. 1. Overview This is the second of a series of posts about setting up a RESTful web service using Spring 3.1 with Java based configuration. The first post of the series focused on bootstrapping the web application; this post will focus on setting up REST in Spring, the Controller and HTTP response codes, configuration of payload marshalling and content negotiation. 2.

Understanding REST in Spring The Spring framework supports 2 ways of creating RESTful services: using MVC with ModelAndViewusing HTTP message converters The ModelAndView approach is older and much better documented, but also more verbose and configuration heavy. The new approach, based on HttpMessageConverter and annotations, is much more lightweight and easy to implement. 3. 1. 2. 3.public class WebConfig{ This is a shortcut, and though it may be useful in many situations, it’s not perfect. 4.

Starting with Spring 3.1, we get first-class testing support for @Configuration classes: 01. 02. 03.public class SpringTest{ 05. 5. 01. 04. 6. Blog.m1key.me: Wizard form with Spring MVC. Today I will show you how to create a wizard form with Spring MVC. A wizard form is a multi-step form that allows users to submit information gradually. With Spring MVC it's very easy to make such a form, as well as validate already submitted data on each step and on finish. Controller This is the main thing. Let's take a detailed look. The controller is annotated with the @Controller annotation.

Now, let's take a look at initialisation code. Next, look at the method that handles GET requests. And now the big thing. If the user clicked cancel, cancel the whole thing by ending the session and redirect to the home page. View I'm using Velocity. And the gender selection page. Property editor Here's the GenderEditor, if you're interested. We need the getAsText() method for validation purposes. Download the source code The source code for this is available on GitHub. Cobalto Labs SAS :: ScalaPrimavera.