FacesContext fctx = FacesContext.getCurrentInstance(); StringBuilder script = new StringBuilder(); script = script.append("alert('Hello World !');"); Service.getRenderKitService(fctx,ExtendedRenderKitService.class) .addScript(fctx,script.toString());
As can be seen, the backing bean code for executing java script in an ADF page is very simple and makes use of the ExtendedRenderKitService from the Trinidad codebase. The approach becomes very useful when you need to generate dynamic JavaScript to inject and execute it in a page at runtime.
No comments:
Post a Comment