I have a struts web application where all logic is in the Action class. Now, I need to expose some functions in the class as a webservice. I plan to move all the business logic to a business delegate class and plan to create a business delegate for the action class. Action class will create a business delegate, and call the functions needed and business delegate methods will be exposed as a service.
I need to know how do I take care of action errors. Can I use ActionErrors class in BusinessDelegates?
Is it a good design to create ActionErrors as an instance property of a business delegate and populate that in business delegate method?
Thanks, S Hasan.
posted 8 years ago
I would not use any Struts classes in my business layer. How are you currently using ActionErrors in your code? If it is for real errors, I would probably throw exceptions from the business tier, catch the exceptions in the presentation tier and populate ActionErrors classes there. If it is from validation, you might want to create your own generic class that could hold validation error information.