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

Executing AmImpl method in managed bean in Oracle ADF | Techartifact

Requirement – Executing AmImpl method in managed bean in Oracle ADF

We can execute the AmImpl method in managed bean using following method.We can get the bindings object.

        BindingContainer bindings = getBindings();
        int checkListID =  ((BigDecimal)valueChangeEvent.getNewValue()).intValue();
       OperationBinding refreshChecklist = bindings.getOperationBinding("checklistQuery");//checklistQuery is method name in Applicationmoduleimpl file
        refreshChecklist.getParamsMap().put("checklistId", checkListID);  // checklistId is parameter for that method.

happy coding with techartifact

Executing bind variable from Application module in ADF – Techartifact

Requirment- To execute the bind variable from application module- Or executing view criteria on page load

Solution- Assumption that you created a view object and view criteria .Now you have bind variable in view criteria.
You are passing the value using some managed bean stored in some scope.

Open the application module and go to data model .Select the the view object in which view criteria is this.Click on edit.

In the edit view instance dialog box.select the view criteria and shuttle to the right.now in the bind parameter value ,open the expression builder
and put right value like – “adf.context.sessionScope.LabelTemplate.taskId” .Here LabelTemplate is managed bean stored in session scope.

That all. Now run the page where you using view object.and page will load with result of bind variable.But note you cant use this VO anywhere where you don’t need a bind variable.

Enjoy coding with techaritfact