I am facing a problem in adding script. Please find my code as below
FacesContext facesContext = FacesContext.getCurrentInstance();
ExtendedRenderKitService extendRenderKitService = Service.
getRenderKitService(facesContext, ExtendedRenderKitService.class);
try {
String methodCall = "afterPPRProcessing('" + journeyId + "',new Array (" + dynamicParams + "))";
System.out.println( "methodCall::" + methodCall);
extendRenderKitService.addScript(facesContext, methodCall);
} catch (Exception ex) {
System.out.println("exception while PPR processing ", ex);
}
I am using
I actually want to generate Omniture based on events like (Button click etc.) afterPPRProcessing is a method in javascript. The code perfectly runs and also prints "methodCall" as
methodCall::afterPPRProcessing('abc',new Array ('xyz','pqr'))
I have set the breakpoint in 'afterPPRProcessing' method while executing page but it doesn't stops at the breakpoint.
Please help me to understand what might be the reason for tagging not generated. Is there any mistake done while writing code.
Thanks in advance
In order to make a call to any javascript function using ExtendedRenderKitService, The function call has to be there in PPR response(response which is generated once the requested page url is hit). During analysis I found that omniture call "afterPPRProcessing" was missing in PPR Response and the reason for it is that after adding script from Bean class using above mentioned code there was a code to refresh entire page.Below is the code
FacesContext context = FacesContext.getCurrentInstance();
String viewId = context.getViewRoot().getViewId();
ViewHandler handler = context.getApplication().getViewHandler();
UIViewRoot root = handler.createView(context, viewId);
root.setViewId(viewId);
context.setViewRoot(root);
This piece of code is doing a page refresh while this method is for capturing PPR event (On/ Off). As a result the script is not getting added to facesContext in ExtendedRenderKitService.
After commenting out this code the PPR call is working fine and I am able to generate matrix.
Thanks to people for helping
Hope this might help others