marktwain18
marktwain18

Reputation: 37

Error in method binding

I want to pass SSJS code from a custom control via a method binding. Here is the code behind the action button for this example:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">
<xc:ccSSJS>
      <xc:this.ssjsCode>
         <![CDATA[#{javascript:
            var app = facesContext.getApplication();
            app.createMethodBinding("#{javascript:var control = getComponent('viewPanel1');print(typeof control);}", null); 
         }]]>
      </xc:this.ssjsCode>
   </xc:ccSSJS>
</xp:view>

But i get the Script interpreter error, why i can't call getComponent method?

Upvotes: 0

Views: 144

Answers (1)

Sven Hasselbach
Sven Hasselbach

Reputation: 10485

It is a little bit complicated to explain why... A workaround is to use the getComponentFor method of FacesUtil class:

com.ibm.xsp.util.FacesUtil.getComponentFor(view,'viewPanel1')

Upvotes: 1

Related Questions