Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

ModelDriven vs. getter for business entity in Action

Thorsten Schäfer

2007-07-31


I'm currently taking a look at Struts 2 and I particularly like getting
rid of ActionForms. As I understand, WebWorks/Struts2 offers two ways to
map forms to business domain objects:
1. I can provide a getter method (getDomainObject()) in the action and
refer to its properties in a JSP by using "domainObject.value".
2. I can use the ModelDriven Interface and return my domain object
there. This enables to access the domain object's values directly using
"value".

I wonder if there are any guidelines or best practices which way to use?
Are there additional benefits/drawbacks of the two alternatives?

Cheers,

Thorsten


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.