lokoko lokoko - 8 months ago 47
Java Question

Invoking an actionListener programatically

I have a use-case where in i want to invoke a fileDownloadActionListener tied to a commandButton programatically. I DO NOT want to invoke it at the jspx level. Basically i want to conditionally invoke the fileDownloadActionListener. If a method returns true then i invoke it else i dont. If i have the fileDownloadActionListener at the jspx level, the moment the commandButton invoking this is clicked, it would fire the pop-up immediately but i want to perform a validation before firing it. Any suggestions ?


This is not as simple as it looks. The fileDownloadActionListener is a client behavior tag, so you can't just queue an action on the button. You must call a JavaScript method which does this for you.

I blogged this solution here.