You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sean gao <se...@secpay.com> on 2006/02/01 17:23:05 UTC

Re: Tapestry 3 - dynamic event listener problem - closed

This worked

public void dispatch(IRequestCycle cycle) {
     	String listenerName = (String)cycle.getServiceParameters()[0];
    		 
((IActionListener)getListeners().getListener(listenerName)).actionTriggered(this,cycle);
     	}



Kent Tong wrote:
>> sean gao wrote:
>>> Thanks Kent,
>>>  > class YourPageClass {
>>>  >   void dispatch(IRequestCycle cycle) {
>>>  >      String listenerName = (String)cycle.getServiceParameters()[0];
>>>  >      ...
>>>  >   }
>>>  > }
>>>
>> But what do I do after
>>   String listenerName = (String)cycle.getServiceParameters()[0];
>> Use reflection to invoke the Method that matches the listenerName?
>> or the less dynamic,
>> if (listenerName.equals("blah"))
>>     blah(cycle);
>> else if ...
> 
> Reflection should be fine.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 

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