struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <...@husted.com>
Subject re: business logic questions
Date Mon, 17 Feb 2003 11:42:39 GMT
Dan McGowan wrote:
 > Now 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?

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.

---
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message