[SCAFFOLD] Elegant way to expose more than one object using Proc essAction

2003-09-22 Thread aies22
Hi,

When using the Scaffold ProcessAction, a data-bean is instantiated by the
framework and it's execute() method is called, returning a ProcessResult
object to the view layer.

The ProcessResult object may contain a single object or a collection (of
values or objects).

Suppose I want to return to the view layer a collection of some sort AND a
single object which has nothing to do with that collection.

In order to do that, what I do now is to create another helper collection in
which I store both the single object\s and the collection I wish to send to
the view layer. Then I return this helper collection as a ProcessResult
object to the view layer, where I have to extract back both the collection
and the single object as separate entities, and define them as beans.

Is there a more elegant way to expose a number of objects\collections of
different types using a single call to ProcessAction?

Thanks,
Noam


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [SCAFFOLD] Elegant way to expose more than one object using Proc essAction

2003-09-22 Thread Ted Husted
You can also return a ProcessResult that is a collection of 
ProcessResults. Just setAggregate to true on the outer result and then 
start adding the others. When it comes back, the ProcessAction will run 
through the collection of ProcessResults and handle each in turn. 
(Composite pattern.) Handling would include automatically exposing each 
result in the chosen scope.

So, yes, there is =:)

HTH, Ted.

[EMAIL PROTECTED] wrote:
Hi,

When using the Scaffold ProcessAction, a data-bean is instantiated by the
framework and it's execute() method is called, returning a ProcessResult
object to the view layer.
The ProcessResult object may contain a single object or a collection (of
values or objects).
Suppose I want to return to the view layer a collection of some sort AND a
single object which has nothing to do with that collection.
In order to do that, what I do now is to create another helper collection in
which I store both the single object\s and the collection I wish to send to
the view layer. Then I return this helper collection as a ProcessResult
object to the view layer, where I have to extract back both the collection
and the single object as separate entities, and define them as beans.
Is there a more elegant way to expose a number of objects\collections of
different types using a single call to ProcessAction?
Thanks,
Noam
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Ted Husted,
  Junit in Action  - http://www.manning.com/massol/,
  Struts in Action - http://husted.com/struts/book.html,
  JSP Site Design  - http://www.amazon.com/exec/obidos/ISBN=1861005512.
Get Ready, We're Moving Out!! - http://www.clark04.com



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]