permaculture playing cards*
The moose likes Struts and the fly likes Struts, Business Delegates and ActionErrors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts, Business Delegates and ActionErrors" Watch "Struts, Business Delegates and ActionErrors" New topic
Author

Struts, Business Delegates and ActionErrors

Sehrish Hasan
Ranch Hand

Joined: Aug 15, 2005
Posts: 43
Hi,

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?

Please reply.

Thanks,
S Hasan.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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.

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts, Business Delegates and ActionErrors