Executing Javascript from the Managed Bean in ADF

Borrowed From:
http://www.baigzeeshan.com/2011/05/how-to-execute-javascript-in-java-in.html

import javax.faces.context.FacesContext;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;

FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService erks =
Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
String myJavaScriptCode = “alert( “+”Hello World”+”);”;
erks.addScript(fctx, myJavaScriptCode );

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s