Usecase : Invoke a java script method from backing bean based on some condition satisfies from managed/backing bean using ADF
Implementation : Have below code in managed/backing bean.
FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
// Invoke a java script method name called showConfPopup()' with two parameters, You can pass any value
erks.addScript(fctx, "showConfPopup('" + popupClientId + "', '" + tabClientId + "')");
Java Script Method ,
Include below code in any jspx in <af:document> element
<af:document>
<f:facet name="metaContainer">
<af:resource type="javascript">
function showConfPopup(popupId, tabId){
alert("Hello");
}
</af:resource>
</f:facet>
Another way of invoking
Implementation : Have below code in managed/backing bean.
FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
// Invoke a java script method name called showConfPopup()' with two parameters, You can pass any value
erks.addScript(fctx, "showConfPopup('" + popupClientId + "', '" + tabClientId + "')");
Java Script Method ,
Include below code in any jspx in <af:document> element
<af:document>
<f:facet name="metaContainer">
<af:resource type="javascript">
function showConfPopup(popupId, tabId){
alert("Hello");
}
</af:resource>
</f:facet>
Another way of invoking
<af:document id=
"d1"
>
<af:clientListener method=
"onPageLoad"
type=
"load"
/>
<f:facet name=
"metaContainer"
>
<af:resource type=
"javascript"
>
function
onPageLoad(evt) {
alert(
"Hello"
);
}
</af:resource>
</f:facet>
</af:document>
No comments:
Post a Comment