Reference Manual for Gracelets - 2.0.0.RC2SourceForge.net Logo
2.1 - Tutorial : In a J2EE/JEE environment
If you want to run this tutorial in a JavaEE/J2EE environment, we recommend JBoss 4.2.0 and up. You can download JBoss 4.2.0 from here.

Once you have downloaded the zip file. You then unzip that file to a directory of your choice. This tutorial will assume you have unzipped the JBoss 4.2.0 into the C:\JBoss4.2.0 directory.

In the C:\JBoss4.2.0\bin directory you will find a file called run.bat file. We can use that later to actually start JBoss and to see the tutorial in action.

Project Directory Structure

The following is a basic directory structure and contents of a gracelet war.
/
WEB-INF/
lib/
groovy-all-1.5.6.jar
jsf-facelets.jar
gracelets-2.0.0.RC2.jar
web.xml
faces-config.xml
index.groovy

Since JBoss AS allows you to use what are called expanded war's, you can actually create the above structure in a sub directory ending in .war of the server deploy directory. You can also download a zip file that contains this basic structure from the gracelet download site at Sourceforge.net. The zip is called clean-war-2.0.0.RC2.zip. If you download it and extract it in the deploy dir (C:\JBoss4.2.0\server\default\deploy) you should see a directory called clean.war in the deploy directory.

Please see the Introduction : Getting Setup for what you need in your web.xml and faces-config.xml files. The clean war zip comes with the basic configuration.

If you created the above structure yourself (instead of downloading the clean war zip) you can open up the index.groovy file and put the following code in it:
Toggle Line Numbers
1 println "This is a new gracelet project" 
Now you should be able to start JBoss by doing the following:
C:\>cd C:\JBoss4.2.0\bin
C:\JBoss4.2.0\bin>run.bat
If you do not configure it otherwise, JBoss will use the first part of your war directory as the name, so like if you used the clean war zip the war directory would be called clean.war. That would make clean the web context root path. The web server would default to localhost and port 8080. Thus you should be able to open up the page by going to http://localhost:8080/clean/index.jsf

You should see a page that says:

http://localhost:8080/clean/index.jsf - Mozilla Firefox
http://localhost:8080/clean/index.jsf
http://localhost:8080/clean/index.jsf
This is a new gracelet project