13

I'd just like to play a little bit with groovy

I was thinking about developing my own-tiny web framework, something very simple and manageable...

So i'd like tou use GSP pages whtout having to install the whole grails stuff, with all its dependencies and behind-the-scenes frameworks...

can anyone provide me detailed instructions on what to download, where to install, how to configure tomcat, etc...


some info I've found so far

Groovy Servlets

GSP Tag Reference

this is pretty close to what I'm looking for, but still don't know what to download, where to save it, etc...

http://groovy.codehaus.org/GSP

And look what it says here...

GSP are not maintained as a standalone module. But it has been forked and reintegrated in Grails.

?

Community
  • 1
  • 1
opensas
  • 60,462
  • 79
  • 252
  • 386
  • I want to "refresh" this question a.d. 2015 (Groovy 2.4). Few years ago I had a short but good experience with non-Grails GSP (groovy 1.7-1.8). – Jacek Cz Aug 20 '15 at 13:31

5 Answers5

17

Well, it seems like it wasn't so hard in deed as I expected

just had to copy groovy-all-1.5.7.jar

from C:\java\groovy-1.5.7\embeddable

to C:\java\Tomcat 6.0\lib

and add the following lines to C:\java\Tomcat 6.0\conf\web.xml

  <!-- Groovy mapping - sas 2009-01-29 -->
<servlet>
    <servlet-name>Groovy</servlet-name>
    <servlet-class>groovy.servlet.GroovyServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>Groovy</servlet-name>
    <url-pattern>*.groovy</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>GroovyTemplate</servlet-name>
    <servlet-class>groovy.servlet.TemplateServlet</servlet-class>    
</servlet>
<servlet-mapping>
    <servlet-name>GroovyTemplate</servlet-name>
    <url-pattern>*.gsp</url-pattern>
</servlet-mapping>

and it worked!!!

I haven't even downloaded the grails installer...

could it really be that easy???

here are some links

http://noor.ojuba.org/2008/06/groovlets-setting-up/

opensas
  • 60,462
  • 79
  • 252
  • 386
  • 3
    Only thing I would add is that I would recommend that you put the groovy jars in the your-webapp/WEB-INF/lib if possible, this will simplify deployment and remove the chance of conflicts with other apps using groovy – Gareth Davis May 19 '09 at 08:18
  • Its old, but see this sample app which shows how to use gsp without grails https://github.com/grails/grails-boot/tree/master/sample-apps/gsp – Sudhir N Apr 11 '17 at 14:57
  • This is what I'm doing as well, but note that TemplateServlet gives you `${...}` and `<% ... %>`, but not tags such as ``. Those would make a substantial difference in readability, not to mention supporting custom taglibs. – Tobia Feb 01 '18 at 14:27
4

Standalone GSP is on the current Grails roadmap. In the mean time see the GSP module project page: https://gsp.dev.java.net/

Hates_
  • 66,613
  • 6
  • 32
  • 37
3

This JavaWorld article might lend a hand:

Shed the weight with Groovlets

Not all web applications require a full stack framework (like Grails, Rails, Spring MVC, etc). Don’t get me wrong, the aforementioned hip frameworks are themselves lightweight (and quite powerful to boot); however, they do have an associated cost (albeit much much lower than rolling the same functionality by hand). For instance, some applications don’t require a data store (consequently, a large portion of Grails — that is, Hibernate — for example, wouldn’t be utilized). Other applications don’t really require a powerful view technology (simple services don’t require JSPs or GSPs, for instance).

codeLes
  • 3,021
  • 3
  • 29
  • 27
  • that link has moved on to https://www.javaworld.com/article/2072589/shed-the-weight-with-groovlets.html – j-mo Oct 26 '18 at 11:30
1

Please check Rabbtor. We provide easy GSP integration to Spring MVC applications with customizations to Grails' tag libraries. Most common tag libraries are supported but some Grails dependent ones were removed.

Cagatay Kalan
  • 4,066
  • 1
  • 30
  • 23
0

I am not sure the taglib functionality is in the Groovlet stuff.

Scott Warren
  • 1,581
  • 1
  • 17
  • 30