Thanks Peter for the reply. I am starting to learning the concepts of
Tapestry, but it takes time to be productive with it. This mailing list
is a great resource and I hope that I will be able to contribute to it
once I have learned more.
Regards,
Mats
p.stavrini...@albourne.com wrote:
Hi Mats,
Should not the best practice be to use the object directly?
Imho no, myObject.id is a bean for the page (object with empty constructor), which is less error prone. Its nearly always better to use a bean to seperate concerns for cleaner, more maintainable code. I.e.: you should not mix database access with view logic, instead use a single bean where possible per page and handle database access in your services (which makes things more testable and reusable)... so it has several advantages.
The bean is like a glue layer (or the view layer in the MVC pattern). So
following this pattern means myObject.id is no less type safe as myObject is
never really going to be null in your page.
regards,
Peter
----- Original Message -----
From: "Mats Andersson" <mats.anders...@ronsoft.se>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Thursday, 3 September, 2009 15:58:20 GMT +02:00 Athens, Beirut,
Bucharest, Istanbul
Subject: Using object or id in Context
Why are most examples written as context="myObject.id"?
Should not the best practice be to use the object directly? This way the
handler method will be more type safe. Do you know of any good
best-practices page for issues like this one?
/Tapestry learner
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org