PDA

View Full Version : With Flex Remoting where Spring Validators come into action?


SpringingSpringles
Apr 30th, 2008, 11:30 AM
Hi,

We are currently developing a Web Rich Internet Application (RIA) using Spring and Flex. I understand that in RIAs most validation is done on client but if I also need to apply Spring validators before saving data. My question where do I plugin these Spring Validators? in business layer?

With flex remoting all calls are directly made to business layer in Spring.

Thanks

bosnic
Apr 30th, 2008, 08:06 PM
I donīt think that you should call business logic directly from view. View is just data presentation. That is why we have controllers. For example, you have a view that is a some kind of data input page. You submit that data to do some business logic. That data is going to controller responsible for that view. Controller executes some data validation (not business logic, just some data validation) and then controller calls business logic. We do things in that way in our systems. Just my opinion. The difference between 'just some validation' and business logic, for me, is this:
you have a method that expects some Integer value. Controller has to assure the value is type of Integer. But, if that value has to be something between 1 and 10 (because buisiness rule says it has to be), than this kind of validation is responsability of 'buisiness logic' bean.