Posts Tagged ‘Spring’

Spring MVC Flash Attribute tutorial with example

Spring MVC Flash Attribute tutorial with example
Spring MVC 3.1 version has added a very useful feature Flash attribute which it lacked and is now solving a long time problem of POST/Redirect/GET pattern.In a normal Web based MVC application each form submitted POST the data to the server. A normal spring controller (tagged with annotation @Controller) fetches the data from request and process it further (save or update in database). Once ...

Spring 3 MVC Interceptor tutorial with example

Spring 3 MVC Interceptor tutorial with example
Spring MVC provides a powerful mechanism to intercept an http request. Similar to Servlet Filter concept, Spring MVC provides a way to define special classes called Interceptors that gets called before and after a request is served.Quick OverviewEach interceptor you define must implement org.springframework.web.servlet.HandlerInterceptor interface. There are three methods that need to be implemented.preHandle(..) is called before the actual handler is executed;The ...

Solve:Errors/BindingResult argument declared without preceding model attribute

Sometimes Spring MVC will amaze you with totally unexpected exceptions. You have no idea why that is coming.For instance, recently I wrote a small piece of Spring MVC Controller code, one like below:@Controller public class UserController {@RequestMapping(value = "addUser") public String addUser(@ModelAttribute("userForm") UserForm userForm, ModelMap map, BindingResult results) {if (results.hasErrors()) { return "add_user_form"; }return "add_user_success"; } //... }And while executing the application, I got a strange exception:Throwable occurred: java.lang.IllegalStateException: Errors/BindingResult argument declared ...

Spring MVC HashMap Form Integration example

Spring MVC HashMap Form Integration example
Spring MVC provides powerful way to manage form inputs. It also provides form validation functionality which is easy to integrate in any application. But other than the normal form bean mapping, recently I had a requirement to map dynamic values like key-value pairs in an HTML form and retrieve the same in Spring Controller. So basically HashMap came to rescue.Let us see how ...

Change spring-servlet.xml Filename (Spring Web Contenxt Configuration Filename)

The first thing that we do when we want to implement Spring MVC in our project is to add DispatcherServlets entry in deployment descriptor (web.xml). Also we write a spring web configuration xxxx-servlet.xml which contains all the MVC mappings and data.By default the name of file must be XXX-servlet.xml where XXX is the name ...

Introducing Cache support in Spring 3.1 M1

Introducing Cache support in Spring 3.1 M1
Spring 3.1 M1 is out with some very useful features. One of the coolest feature in the latest release is comprehensive Caching support!Spring Framework provides support for transparently adding caching into an existing Spring application. Similar to the transaction support, the caching abstraction allows consistent use of various caching solutions with minimal impact ...

Spring Roo: Customizing Web MVC UI Forms

Spring Roo: Customizing Web MVC UI Forms
There are many features that I like from Spring Roo:The shell is very effective for constructing projects -with a helpful tab completion- Round-trip is essential to keep the code in sync Code generation without "unnecessary abstractions" is refreshing -although version 1.1.2 might bring some of them back- just to mention a few.At the top of the list, I am ...

Spring Roo: Saving/Retreving BLOB object in Spring Roo

Spring Roo: Saving/Retreving BLOB object in Spring Roo
After reading the excellent article titled Saving/Retreving BLOB object in Spring MVC/Hibernate immediately came to my mind:How would it be the process of recreating the same example but using Spring Roo. What would it be the similarities/differences in the projects source code.The article assumes the Reader is a Developer with some familiarity with Spring Roo. For introductory information about Spring ...

How to implement Master/Detail forms using Spring Roo

How to implement Master/Detail forms using Spring Roo
I jumped in the Spring Roo wagon since version 1.1.0M1. The first thing I wanted to do after got used to it. It was to try typical requirements that come very often in the work of a Web Developer. I needed a wep app to work on, so I came up with World Alamac by jD. Basically, WorldAlmanac web ...

Spring Roo: Two Databases Configuration

Spring Roo: Two Databases Configuration
I've seen very often a recurrent question on Spring Roo forums. The question is "How to configure the application to handle two databases".Certainly this is a more ample question to Spring Roo only, due it involves JPA and the Spring persistence stack. So, I believe it will be of interest to all the Spring development community ...
Page 1 of 212