views:

88

answers:

1

Title says it all really.

I have a login form that has some validation on many pages in my website.

How best do I structure my controllers to avoid repeating the validation logic etc.

Bear in mind some of these pages have their own controller requirements e.g. reference data. So one exactly identical controller cannot be used.

The requirements specify that any validation errors appear on the page where the user entered the error.

Thanks in advance!

A: 

You can have a custom validator using spring validator interface. You can then reuse the same validator in multiple places using the pushNestedPath and popNestedPath.

REF#
Validator REF

Teja Kantamneni