Groovy JSR 168 Portlet HowTo for IBM WebSphere Portal Server
IBM software engineers Suhel Parekh and Ron Lynn describe in their developerworks article titled "
Embedding Groovy in a JSR 168 portlet for total scripting power" how to bring your portlets to life by integrating the dynamic Groovy shell.
First they create a standard JSP portlet. Then Groovy libs are added and standard java servlet and portlet variables are bound to the Groovy shell (request, response, context, logger, test). The basic idea is simple: use the edit mode of the portlet to enter Groovy code in the portlet preferences under the key 'code' and use the view mode of the portlet to compile the Groovy code on the fly and display the result of running the generated *.class file.
The compile-run-and-output procedure is very similiar to any JSP page or portlet, with the difference that the edit mode of the portlet property provides a text/code editor for free and no text files are changed at run-time and no redeployment is necessary. This is a great time saver for quick edit-compile-test cycles when you want to try something and dig deeper into portlet programming.
Although the authors use the IBM Rational Developer IDE with portlet support it should be possible to achieve the same result with Eclipse or pure Texteditors. And since the only prerequisite is a JSR 168 compatible portlet container it should run in open source portal servers like Liferay or Jetspeed too.
Grails guru Glen Smith from Australia is working an a book named Grails-in-Action for Manning and in the advanced 'enterprise' section he plans to write about portlets too: "(JMX, EJB3, JMS, JNDI and probably a little portlets by then)".
Portlets may be a nice user interface but are surely not a gift to developers due to restrictions and long development cycles. Inserting some Groovy into portlets may speed portlet development significantly and one can see the first sights of this trend on the web already.
