Best way to bind a non-managed bean to an xPage? -


what best way bind non-managed bean xpage? use xpages controller classes in java, , limit classes specific xpage without using managed bean in faces-config.

tried use datacontext , of methods work, not able document data source, using resolvevariable method. returns doc=null. same java class managed bean returns data source correct.

are there better ways connect bean specific xpage?

you can connect java controller xpage in beforepageload event:

    <xp:this.beforepageload><![cdata[#{javascript:         viewscope.controller = new com.yourdomain.controller.mycontroller();         controller.beforepageload()}]]>     </xp:this.beforepageload> 

then can call methods of controller using el this:

#{controller.save} 

or can connect events controller:

<xp:view xmlns:xp="http://www.ibm.com/xsp/core"     afterpageload="#{controller.afterpageload}" 

your controller has access document data source.

    public void save() throws exception {         dominodocument doc = (dominodocument) jsfutil.resolvevariable("currentdocument");         system.out.println("save(" + doc.getdocument().getuniversalid() + ")");     } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -