Yes, this is tricky and I'm thinking I'm not happy with the way it currently works.
Your best option is to implement onActivate(Object[]) and do any coercions from there. This will be invoked regardless of the number of values in the context (even zero). I'm thinking the change will be: a method will be invoked if the context has at least as many values as the method has parameters, and will silently skip those that request too many. Nope, that still doesn't handle it for the common case that you want to catch the "no activation context" scenario. On 2/23/07, D&J Gredler <[EMAIL PROTECTED]> wrote:
Hi, I'm using the activate / passivate infrastructure in T5, and have a question about it. I have the following methods on a search page: public String onPassivate() { return this.jurisdiction; } public void onActivate(String jurisdiction) { this.jurisdiction = jurisdiction; } This works for URLs of the form "http://www.host.com/search/atlanta". However, if a user ever goes to "http://www.host.com/search", he will get an ugly error page for an IllegalArgumentException, with a message like "Method com.of.pages.AbstractJurisdictionPage.onActivate(java.lang.String) has more parameters than there are context values for this component event." I'd like to be able to handle this condition myself, and thought I might be able to do so if I added a parameter-less onActivate( ) method, but no cigar: public void onActivate() { // redirect to home page, or use a default jurisdiction } What are my options here? Daniel
-- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]