You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Athneria, Mahendra" <ma...@atos.net> on 2012/09/06 11:44:09 UTC

activation context method

Hi,

I am facing a weird problem related to the activation method of page.

I have three pages named as, Page1, Page2 & Page3.

In Page1, I have two activation methods.

@OnEvent(value = EventConstants.ACTIVATE)
      public void activateFromDetails(String contractNumber, String pageName) {
            this.contractNumber = contractNumber;
            this.pageName = pageName;
      }

@OnEvent(value = EventConstants.ACTIVATE)
      public void activateFromList(boolean isCreate, String pageName) {
            this.isCreate = isCreate;
            this.pageName = pageName;
      }

When I come from Page2 to Page1 - I'll pass "Boolean" and "String" as a context parameter

When I come from Page3 to Page1 - I'll pass "String" and "String" as a context parameter

Now the weird situation occurs, both the activation method getting called in Page1, irrespective of the context parameter.

Any idea why both the activation getting called???

Regards,
Mahendra


Re: activation context method

Posted by Lance Java <la...@googlemail.com>.
1. It's a very bad idea to have 2 onActivate methods with the same parameter
count. If I hit the URL "/yourpage/true/somePage", how does tapestry know
which one to call?

2. I have NEVER needed multiple onActivate methods. If I need to handle
multiple cases, I have a single onActivate(EventContext) method.

3. If you still want multiple onActivate methods, return true to avoid
processing other onActivate methods.





--
View this message in context: http://tapestry.1045711.n5.nabble.com/activation-context-method-tp5716091p5716093.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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