While building web applications with Java I always felt the need for a language which is more agile then Java, but integrates well into the Java ecosystem.
When I checked out Groovy, I felt that this is exactly what I was looking for. The integration into Java is seamless, but the language has a lot of characteristics of scripting languages.
Unfortunately Groovy did not have a good support for building web applications, so I started GvTags.
(August 2004, tof)
This is an excerpt from examples/primenumbers.jsp in the GvTags release and shows how GvTags can be used:
<!-- Output calculated primes -->
<gvt:if test='inputValid' >
<gvt:gstring>Calculated primes up to ${max}:</gv:gstring>
<br />
<gvt:for var='isPrime' in='primeField' index='i' >
<gvt:if test='isPrime'>
<gv:out expr='i' />
</gvt:if>
</gvt:for>
</gvt:if>
See the Quick Guide how to install the all-in-one release and start working with GvTags.
The GvTags tag library makes it possible to use the Groovy scripting language in JavaServer Pages (JSP) or in GTL pages.
To learn more about all Tags defined in the library see Tags!
Here is a discription how to implement the MVC pattern with GvTags and how to use the actionbean tag or the ActionServlet: ActionServlet and MVC
The TagTemplateEngine of GvTags can be used to create any text based documents from Groovy, from Java, as an ant task or from the command line, see TagTemplateEngine. It uses the GvTags Template Language (GTL) to create documents.
With the all-in-one release GvTags can simply be called from the command line, see: command line parameters.
GvTags supports automatic recompilation for JSP and for GTL through the TagTemplateServlet. When a page with Groovy code changes, it will automatically be recompiled. Through a special class loader the class will be replaced by the new verison. A reload of the page in the browser will show the changed version.
Also Groovy application classes in WEBINF/groovy will be automatically recompiled and reloaded when they are changed. At the moment this works for objects in request scope and Groovy Scope but not for session scope and application scope. Objects in request and grooyv scope are created again for every request and therefore they will be build from the changed class. But you should'nt keep to much in session or application scope anyway.
This makes developping GvTags applications very agile, since the edit/compile/link/go/test-cycle is minimized.
Frequently Asked Questions see the FAQ
Subscribe to the [mailing list] or contact GvTags.
Groovy is not very good in error reporting and GvTags is even worse. So finding errors with GvTags can easily become a nightmare.
Here some helpful hints:
The class definition of an already exiting bean cann't be changed in Java. A bean already instantiate will not use the changed implementation even if the groovy file has changed and is automatically compiled. To use the new implementation, the bean must be reinstatiated. For beans in application or session scope this can only be done by a restart of the application or by creating a new session.
If an external groovy class, which is used by GvTags page, contains an syntax error, the JSP page will only show the error: class not found. Since this gives not much hints about the real error, you should use JUnit with GroovyTestCase to test external groovy classes before using them from a JSP.
Read more about the Source Release.
There are some other approaches for web applications in Groovy