Dashboard > Groovy > ... > Modules > GSP
GSP Log In | Sign Up   View a printable version of the current page.

Added by Pilho Kim , last edited by Jeff Brown on Sep 02, 2007  (view change)
Labels: 
(None)

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


GSP means GroovyServer Pages, which is similar to JSP (JavaServer Pages).


GSP Module Project has started originally by Troy Heninger.

The original sources of GSP module 1.1 can be found at Groovy's SVN repository.

There is also a new GSP project page: https://gsp.dev.java.net/

Sample GSP: AttributeTest.gsp

<%
    if (session.counter == null)
        session.counter = 1
    else
        session.counter++

    session.setAttribute("id", "tmpID")
    session.setAttribute("uid", "userID")

    request.x = 123
    application.x = 500

    if (application.counter == null)
        application.counter = 1
    else
        application.counter++

%>

application.counter = ${application.counter} <br>
session.counter = ${session.counter} <br>
session.id = ${session.id} <br>
session.uid = ${session.uid} <br>
session.getAttribute('id') = ${session.getAttribute('id')} <br>
request.x = ${request.x} <br>
(application.x == null ?) = ${application.x == null} <br>
application.x = ${application.x} <br>

web.xml

<servlet>
    <servlet-name>GSP</servlet-name>
    <servlet-class>groovy.modules.pages.GroovyPages</servlet-class>
    <init-param>
         <param-name>encoding</param-name>
         <param-value>ISO-8859-1</param-value>
    </init-param>
    <init-param>
         <param-name>debug</param-name>
         <param-value>0</param-value>
    </init-param>
</servlet>

<servlet-mapping>
    <servlet-name>GSP</servlet-name>
    <url-pattern>*.gsp</url-pattern>
</servlet-mapping>
</servlet>
Site running on a free Atlassian Confluence Open Source Project License granted to The Codehaus. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.2 Build:#919 Nov 26, 2007) - Bug/feature request - Contact Administrators