Tuesday, 5 November 2019

Run JavaScript Method in Java / ADF & OAF

Run JavaScript Method in Java / ADF & OAF   

** it is not Oracle standard.
Example Code :
 try {
      ScriptEngineManager manager = new ScriptEngineManager();
      ScriptEngine engine = manager.getEngineByName("Js");
        engine.eval("function run() {alert(123);}");
        Invocable invokeEngine = (Invocable) engine;
        Runnable runner = (Runnable)invokeEngine.getInterface(Runnable.class);
        Thread t = new Thread(runner);
        t.start();
        t.join();
      }
    catch (ScriptException e)
    {
      // TODO
    }
    catch (InterruptedException e)
    {
      // TODO
    }


incase of any null pointer Exception
visit Get JavaScript Engine Name

No comments:

Post a Comment

How To: Remove all rows from view object (VO) in OAF & ADF

This is the basic requirement when we are working with oracle OAF. In which we need to removed the all rows from the table. The best use ca...