From Jsp I understand that I can give mutiple actionlistner in one actionListener attribute. I want to simulate the same thing in java code using HtmlCommandLink class.
 
My code fragment is as below
 
    public HtmlCommandLink makeCommandLink(UIComponent comp, String actionEL, String listenerEL) {
        HtmlCommandLink uiLink = new HtmlCommandLink();
        if(actionEL!=null){
         uiLink.setAction(makeActionBinding(actionEL));
        }
        if(listenerEL!=null && !listenerEL.equalsIgnoreCase("")){
         Class[] arg = {ActionEvent.class};
         uiLink.setActionListener((makeListenerBinding(listenerEL, arg)));
        }
        uiLink.getChildren().add(comp);
        return uiLink;
    }
 
    public MethodBinding makeListenerBinding(String el,Class[] arg) {
     FacesContext ctx = getFacesContext();
     if (ctx != null) {
   Application app = ctx.getApplication();
   return app.createMethodBinding(el, arg);
   
     } else {
      return null;
     }
    }
 
Not I want to add two actionListeners in one HtmlCommandLink.I mean instead of using
uiLink.setActionListener((makeListenerBinding(listenerEL, arg)));
I want to use uiLink.addActionListner();
 
First one takes MethodBinding as a parameter but where as the other one takes ActionListner as a parameter.
 

Andrew Robinson <[EMAIL PROTECTED]> wrote:





You can only have one actionListener attribute though (I'm fairly
positive). The actionListener type only takes a Java class name, not a
method binding. If you need more than one action listener method
binding, you will have to make a custom UICommand object I believe.

On 6/19/06, Tushar <[EMAIL PROTECTED]>wrote:
>
> In one of my custom renderer I am using actionlistener in HtmlCommandLink.
> HtmlCommandLink has setActionListener method which takes MethodBinding as a
> parameter. I have my actionListener method in one of my beanclass. My
> beanclass does not implement or extend any of JSF framework interface or
> class and I want to keep it same way.
>
> Now I want add one more action listener on the same HtmlCommandLink. Idea is
> to invoke two different actionListener(Both of them are in different
> beanclasses) whenever the link is clicked. I could see addActionListner
> method in HtmlCommandLink class. I could not figure out how to register my
> bean actionlistner methods through addActionListener method.
>
> Does anybody has any idea on this?
>
> Regards
>
> Tushar
>
>
> ________________________________
> Yahoo! India Answers: Share what you know. Learn something new Click here
> Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download
> now
>
>


Yahoo! India Answers: Share what you know. Learn something new Click here
Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now

Reply via email to