Requirment- Sometime we want to execute javascript from Java in ADF.How to achieve this.below code tell you about this.
import javax.faces.context.FacesContext; import org.apache.myfaces.trinidad.render.ExtendedRenderKitService; import org.apache.myfaces.trinidad.util.Service; FacesContext fctxObj = FacesContext.getCurrentInstance(); ExtendedRenderKitService eRKS = Service.getRenderKitService(fctxObj , ExtendedRenderKitService.class); String javaScriptCode = "alert( "+"Het you executed javascript in Java .Hurray vinay"+");"; eRKS.addScript(fctxObj , javaScriptCode );
Thats it. enjoy. Happy coding with Techartifact with Vinay Kumar….. 🙂