Sometimes you need to capture changes to entities just before they get saved to the database. In some systems, a change to a person’s bank account or tax liability may trigger a lot of processing.
While you could be tracking these via DTOs – the process can be quite repetitive and error-prone. You could also use database triggers for that, but you shouldn’t really. Even if the entire extra-processing is inside your database, your application will have no visibility of that.
Continue reading
Category Archives: Spring MVC
Add conversation support to Spring MVC
One thing I miss in Spring-MVC is the concept of a conversation-scoped attribute. It was supposed to be added in v3.2, but seems to have been pushed back – and I think it might not be done at all, as Spring Webflow currently supports it. However – using webflow just for the sake of enabling a conversation scope seems a bit harsh for my humble Spring-MVC applications. So I went in search of a solution, but ended up writing one myself.
Continue reading
Tabbed forms with Spring MVC and Bootstrap 2
In the previous part of this mini-tutorial, we didn’t actually do much. We really just split a large form into tabs and put it under Twitter Bootstrap’s styles. In this part I’ll show how to implement a cool feature that make your tabbed forms so much more user-friendly: how to return to the active tab on submit.
Continue reading
Tabbed forms with Spring MVC and Bootstrap (part 1)
Tabbed forms are awesome. When you have a data-entry intensive web application – they can sometimes make the difference between a dull looking application and a friendly one. However – they are not a good fit for every scenario.
Continue reading
Spring MVC and Twitter Bootstrap – customizing the input fields
So, in my latest project I am using Twitter Bootstrap together with Spring MVC 3.1. It’s sort of best of both worlds as Bootstrap takes away a lot of the pain on one hand, and Spring deals with the other hand (which works well for me).
Anyway – I am not going to say much more about these guys together – just that it’s been awesome so far, and without further ado here’s a little tag I put together to allow your Spring MVC views to use the Twitter Bootstrap layout, and also display errors in the Bootstrap way.
Continue reading
Spring MVC 3.x with STS Tutorial – Part III – Add some JPA
In the first version of this post, I showed how to do this using Roo. However, this seems to create too much pain, so I have updated the post to describe ‘normal’ usage of JPA (with the spring-data project). So – if you see comments below that seem irrelevant – this update is the reason.
In the previous part, we set up a little request flow that used Spring MVC to define a request mapping into our DOC system, and provide the user with a list of tramps retrieved from the a service. We also hooked it all up together nicely as components (using the @Controller and @Service Spring Stereotypes) – so they all play together seamlessly.
In this part we’ll get our tramps web application to read tramps information from the database. This is quite easy to do with Spring, using the spring-data project, particularly – spring-jpa.
Continue reading
Advanced @RequestMapping tricks – Controller root and URI Templates
Request mapping with Spring MVC 3.1 is quite sophisticated, and lets you use quite a few neat tricks. The following are two particularly tricky bits that are not very straight-forward to get directly from the documentation:
Continue reading
Customize form:errors output on Spring-MVC
Baa.. took a lot of searching in code, and I don’t particularly like the result – but it is what it is. The main issue is that my designer wanted us to get clever with how form validation error messages are displayed to the user. the <form:errors> tag is very useful for most cases – where you basically only want to display the errors to the users, perhaps with a specific class in mind. You can also ask it to change its default rendering of a <span> element to, say, a <div> element – but my designer wanted something else completely, and sent me on a wild goose chase.
Continue reading
Spring MVC 3.x with STS Tutorial – Part II
Ok, I finally got around to do this. Sorry for the wait, but I was pre-occupied with, well – life, work and everything in between.
In the first part of this tutorial, I walked through setting STS up, and dealing with the default project you create with the Spring-MVC template. In this part – I want to try and go a bit deeper – so I’ll touch a bit on mapping requests and on displaying data to the user.
Spring MVC – DispatcherServlet
In a previous post about Spring MVC I touched briefly about the DispatcherServlet and what it means for Spring-MVC.
In this post I am going to dive a bit deeper into the the DispatcherServlet and how Spring MVC uses it.
Continue reading









