struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Johnson <>
Subject An XDoclet approach (was: DynaActionForm Advantages)
Date Thu, 11 Jul 2002 00:39:51 GMT wrote:

>Something that has always bothered me in Struts is the "disconnect"
>between Form Beans and Model Beans.  How many times do you have a Form
>Bean and a model bean that contain the same data? 

In Roller, I solved this problem by using XDoclet.  I use an abstract 
class marked up with both @struts:form and @ejb:data-object tags for 
each of my model objects.  Then XDoclet generates both my model objects 
(data objects, value objects or whatever you want to call them).  The 
form object know how to return data objects, so I don't need to do any 

Here is an example of one of those marked up beans:

This is not an ideal approach because 1) it assumes that you will have a 
1:1 correspondence between form beans and action beans.  But it works 
well for me.
If I need to have a form with fields that are no part of the corresponding
data object, then I extend the generated form class and add the fields 
that I need.
And 2) the model objects tend to be pretty dumb - but so far this has 
not been a big problem.

You can read more about the Roller architecture here:

I'd love to hear any feedback about this architecture you might have, 
especially negative feedback - I'd like to know what I can improve.

- Dave

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message