PDA

View Full Version : Validation questions



Alarmnummer
Mar 1st, 2005, 08:43 AM
I have a few questions about validation.

1) If the controller has validated the input should the service check the input again? The service should not rely on the fact that the controller has validated the input imho.

2) There are different levels of validation. There are some constraints that apply for every instance of a class, eg.. the age of a employee should never be smaller than 0, or greater than 150. But there are also other constraints.. an employee should not be able to edit his own wage, although wage is part of every employee. So you need on top of the class validation some kind ofrolebased validation. If have checked the "J2EE Design and Development" book, but nothing was mentioned there. A simple solution would be to chain the validators, but I find it strange I haven`t seen it yet.

3) The validator is not bound to the entity. So if I set some fields in a service, should the the service validate with a Validator aswell? How does the validator integrate with normal business logic? Or should normal business logic not rely on a validator and should it be hard coded?

Ben Alex
Mar 2nd, 2005, 04:37 PM
You might find some ideas here: http://forum.springframework.org/viewtopic.php?t=1805.

Jeff Lee
Mar 21st, 2006, 11:06 AM
Hi Ben,

Your link to "viewtopic.php?t=1805" is just not panning out.
Can you relink the answer to this thread?

Thanks in advance.

Jeff

digerata
Aug 5th, 2006, 11:54 PM
Ditto. Does this thread still exist?