Posted By:
Ted_Husted
Posted On:
Thursday, January 24, 2002 02:00 AM
It is useful to create a Result bean that contains all the
data you need for th response. But the Struts beans tags,
and other presentation systems, are designed to
use any JavaBean. So, you can just create whatever
bean suits your needs.
In the beginning, the framework tried using plain beans,
but found that we really needed the validate() and
reset() methods to make the input/correct cycle work.
But for output this doesn't apply, so there is not
much to be gained by just having the ActionServlet
create some arbitrrary bean for you.
Also, going into an Action you don't always know what
page will be used in the result. The Action really
needs to determine what bean to create based on
what page it decides to forward to.
There are useful, reusable object you can create to carry
results to the presentation layer. One such is the
ModeResult object in my Scaffold package. It has
properties for a title, and a collection, and so forth. But
there can be many such as this, and it would be wrong for
the framework to endorse just one :)
If you do find it convenient to specify a result bean
in the ActionMapping, you can extend the ActionMapping
class and include new properties, if you like.
HTH -Ted