executing Javascript in Java in Oracle ADF

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….. 🙂

Vinay

I am an Oracle ACE in Oracle ADF/Webcenter. Sr Java Consultant-working on Java/J2EE/Oracle ADF/Webcenter Portal/ content and Hibernate for several years. I'm an active member of the OTN JDeveloper/Webcenter forum. Passionate about learning new technologies. I am here to share my knowledge. Give your views and suggestion on [email protected] .

More Posts - Website

Follow Me:
TwitterLinkedInGoogle PlusYouTube