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
Monthly Archives: April 2012
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




