Let’s pull out some of the key practices to take away from the chapter:
1.Use flash scope. Flash scope is ideal for passing messages to the user
(when a redirect is involved).
2.Use the errors object wisely. Make use of the errors object on your
domain class to display validation messages. Take advantage of resource
bundles to make error messages relevant to your application use cases.
3.Use command objects. Take advantage of command objects for form
submis-sions. Don’t just use them for validation—they can also be handy
for encapsu-lating tricky business logic.
4.Understand data binding.Data-binding options in Grails are plentiful
and sub-tle. Understand how data binding works for child objects when
form parame-ters are prefixed. Use whitelisting to ensure that data
binding doesn’t compromise sensitive fields.
5.Be forgiving with URLs.Use default actions to make URLs more
forgiving, and do the same for custom URL mappings. Permalink-style URLs
are much easier to remember and not difficult to implement.
6.Apply filters. Employ filters when you need to selectively fire
backend logic based on URLs or controller-actions combos.