background preloader

Spring 3.0

Facebook Twitter

Spring MVC form handling annotation example. In this tutorial, we show you how to do form handling by using annotation in Spring MVC web application. 1. SimpleFormController vs @Controller In XML-based Spring MVC web application, you create a form controller by extending the SimpleFormController class. In annotation-based, you can use @Controller instead. SimpleFormController public class CustomerController extends SimpleFormController{ //...} Annotation @Controller @RequestMapping("/customer.htm")public class CustomerController{ //...} 2. formBackingObject() vs RequestMethod.GET In SimpleFormController, you can initialize the command object for binding in the formBackingObject() method.

@Override protected Object formBackingObject(HttpServletRequest request) throws Exception { Customer cust = new Customer(); //Make "Spring MVC" as default checked value cust.setFavFramework(new String []{"Spring MVC"}); return cust; } 3. onSubmit() vs RequestMethod.POST In SimpleFormController, the form submission is handle by the onSubmit() method. Bean Validation: Integrating JSR-303 with Spring « JTeam Blog / JTeam: Enterprise Java, Open Source, software solutions, Amsterdam. I recently had a chance to actually use the new Bean Validation spec. in one of my projects.

Bean Validation: Integrating JSR-303 with Spring « JTeam Blog / JTeam: Enterprise Java, Open Source, software solutions, Amsterdam

As the developer of the Bean Validation Framework for Spring (part of the springmodules project) it of course feels a bit weird to ditch all the work I've done, but at the same time, it also feels good to use a standard spec that very soon will be finalized. As a member of the JSR-303 expert group (although quite a quiet member) I can assure you that the guys (special kudo's to Emmanuel Bernard) worked really hard to come up with a specification that will fit in many of the different programming models and technologies we all use (e.g. JPA, JSF, Swing, etc..). Spring 3 MVC and Hibernate 3 Example Part 2. Spring 3 Type Conversion and Validation. The Spring 3 final release is right around the corner, and it's going to be a great release.

Spring 3 Type Conversion and Validation

In this blog entry, I will take you through some of Spring 3's type conversion and validation enhancements. Whether you are developing a traditional web application, a desktop application, or a "next-generation" RIA, data binding, type conversion, and validation are important areas. Spring Web Flow Portal. 15. Web MVC framework. 15.1 Introduction to Spring Web MVC framework The Spring Web model-view-controller (MVC) framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution, locale and theme resolution as well as support for uploading files.

15. Web MVC framework

The default handler is based on the @Controller and @RequestMapping annotations, offering a wide range of flexible handling methods. With the introduction of Spring 3.0, the @Controller mechanism also allows you to create RESTful Web sites and applications, through the @PathVariable annotation and other features. REST in Spring 3: @MVC. In the last couple of years, REST has emerged as a compelling alternative to SOAP/WSDL/WS-*-based distributed architectures.

REST in Spring 3: @MVC

So when we started to plan our work on the next major release of Spring - version 3.0, it was quite clear to us that we had to focus on making the development of 'RESTful' Web services and applications easier. Now, what is and isn't 'RESTful' could be the topic of a whole new post all together; in this post I'll take a more practical approach, and focus on the features that we added to the @Controller model of Spring MVC.

A Bit of Background Ok, I lied: there is some background first. If you really want to learn about the new features, feel free to skip to the next section. For me, work on REST started about two years ago, shortly after reading the highly recommended book RESTful Web Services from O'Reilly, by Leonard Richardson and Sam Ruby. Spring Security 3 (9781847199744): Peter Mularien. MVC Simplifications in Spring 3.0. As Juergen and Arjen have mentioned, Java developers everywhere have a smooth upgrade with Spring 3.0.

MVC Simplifications in Spring 3.0

Now that Spring 3 is out, I'd like to take you through some of the new MVC features you may not know about. I hope you find these features useful and can start putting them to work in your web applications immediately. This is also the start of a series on "Spring 3 Simplifications", so expect more posts like these in the coming days and weeks. Configuration Simplification. Configuration Simplifications in Spring 3.0. Second in a series of posts on "Spring 3 Simplifications" started yesterday by Keith, I'd like to provide a very brief and hands-on introduction to Spring's new @Configuration annotation and related support.

Configuration Simplifications in Spring 3.0

As those that followed the Spring JavaConfig project will know, a @Configuration-annotated class serves much the same role as a Spring XML file. It provides a code-centric way of declaring Spring bean definitions using nothing more than methods and annotations. You might call it Plain Old Configuration* :) This means that for simple situations, no XML will be required! Ajax Simplifications in Spring 3.0.