This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts, Business Delegates and ActionErrors

 
Sehrish Hasan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic