2 Replies Latest reply on Aug 20, 2012 7:03 AM by Luthiger

    Accessing ScriptEngineFactory in CQ5 component

    Luthiger

      I’d like to leverage the scripting capability (provided by Java/Sling) in a CQ5 component. In essence, the component’s dialog will provide a TextArea field where the author can write a ECMA script which then will be evaluated by the component for that the result can be displayed on the page containing the component.

       

      For that I can evaluate the scripted input by the author, I create a javax.script.ScriptEngineManager and try to get a ScriptEngineFactory from this manager instance. However, when I call ScriptEngineManager.getEngineFactories(), I get an empty list.

       

      How do I have to proceed to get a ScriptEngineFactory instance (e.g. RhinoJavaScriptEngineFactory) in my CQ5 component?