If you want to use a method binding this path, you need to create a method binding as a parameter for a custom control:
<xc:ccMethod> <xc:this.codessjs> <![CDATA[#{javascript: var app = facesContext.getApplication(); app.createMethodBinding("#{javascript:print('HELLO!');}", null); }]]> </xc:this.codessjs> </xc:ccMethod>
Then your button inside the custom control can call the method. In this case, the button will print HELLO! to the server console.
EDIT:
The CSJS property type is a string. To execute CSJS code, you can change your button in your user control something like this:
<xp:button value="Label" id="button1"> <xp:eventHandler event="onclick" submit="false"> <xp:this.script><![CDATA[#{javascript:compositeData.codecsjs}]]></xp:this.script> </xp:eventHandler> </xp:button>
In XPage, a custom control property can be populated as follows:
<xc:ccCSJS> <xc:this.codecsjs> <![CDATA[alert("ABC");]]> </xc:this.codecsjs> </xc:ccCSJS>
Hope this helps
Sven
source share