I would like to isolate the business logic to a bean class and use the scaffold ProcessAction class ala the Artimus app in Struts in Action. Since the bean class has all the business logic, how do I communicate errors?

Ted Husted

Excellent question! The Scaffold solution is to use a ProcessResult object that encapsulates the typical things that the Model might want to send back to the Controller/View. So far, it can transfer data, a numeric code, messages, a dispatch instruction, along with a name and a scope.

If the ProcessAction sees that the ProcessResult contains messages, it converts those to ActionMessages. If it sees it contains data, it expose that data under the given name and scope. And so forth.

ProcessAction uses a very simple message format. It's just a list where the first entry is the template key and everything else is replacement parameters. Easy to build, but you can only send back one message.

Now that we have a Message object in the Commons, I'm migrating a new version of ProcessResult/ProcessAction to use the Commons Messaging. But, the basic design pattern remains the same.

HTH, Ted.
Struts in Action