Liferay 6 : Run a script (groovy, javascript, beanshell) using Java code
Liferay supports a lot of scripting languages: beanshell, javascript, groovy, python, ruby
You can execute a script directly from Liferay administration panel or by calling a java method.
You can have access to the whole Liferay API and all API that are common to your application server (for example, classes that are put in tomcat lib/ext folder). For this you will have to pass the global classloader when executing the script.
In the following example we will execute the below Groovy script using Java.
Here is the Groovy script:
Next, Java snippet that will execute the previous Groovy script: