On Tue, 02 Nov 2010 05:08:08 -0200, Vjeran Marcinko <vjeran.marci...@email.t-com.hr> wrote:

Hello all.

Hi!

URL path context and onActivate/onPassivate mechanism seemed sufficient until I started using it for any non-trivial page. By non-trivial, I mean any page that can be activated via different activation contexts, and differentation via parameter count and order is simply too cumbersome

Is it that cumbersome to have a single onActivate(EventContext context) method? EventContext.getCount() gives you the number of parameters and EventContext.get(int index, Class type) returns you a given ordered parameter already converted to your desired type through TypeCoercer.

(eg. my GenericEditPage can be activated via "companyId" *or*
"employeeId" parameter, both of type Long,

My Tapestry-CRUD has a generic edition page implemented with activation context with no problems or complexities.

not to mention search page  results etc..).

Query parameters suite best when you have many parameters.

Query parameters are also perfect for cases when one has class hierarchy of pages, where you want to place some common logic in superclass, eg. when you have some company-related pages where all have "companyId" in URLs beside their page-specific ones, and you want to do some logic with this parameter. This is very cuombersome to achive when parameters are placed in URL path.

Just have an onActivate(EventContext context) method in the top of the hierarchy and let subclasses override it as needed. Not cumbersome in my humble opinion.

I thought most of users of T5.2 will use this new way instead of URL path since it is soooo much more flexibile. C'mon people, try using this annotation and you'll see how much easier this way of passing parameters is!

You're not used to the page activation context, while most people in this list are, specially the ones who started learning Tapestry before 5.2.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to