Grails simplifies spring controllers
I picked up on a blog post by Carl Fyffe, not somebody who I am familiar with but hey that’s the joy of Google blog search.
Carl gives Grails a nod and complains about problems handling different request types and how you need multiple controllers when using Spring MVC. Not so with Grails! Grails sits on top of Spring but adds value. In 0.3 support was added for restricting HTTP methods. Couple that with the support for multiple actions per controller and per-action HTTP methods, you get a solution I think Carl would enjoy. And guess what, no XML config. At all.
Here’s the example from Grails’ website:
class PersonController {
// action1 may be invoked via a POST // action2 has no restrictions // action3 may be invoked via a POST or DELETE def allowedMethods = [action1:'POST', action3:['POST', 'DELETE']] def action1 = { ... } def action2 = { ... } def action3 = { ... }}





















1 Comment
Carl Fyffe
February 17, 2007Beautiful! It seems like it may be time to start digging into Grails a little further. Thanks for the tip!