Monthly Archives: April 2012

Spring MVC 3.x with STS Tutorial – Part III – Add some JPA

Michelle II

Creative Commons License photo credit: Shandi-lee

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

Customize form:errors output on Spring-MVC

Rylee Brooks

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

Studio_71a

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.

Continue reading