Groovestry Indeed!
Howard likes my Groovy listener methods implementation but
thinks I'm on a mission to rid the world of XML config files. Let's take a walk down that road.
I've experimented with Groovy Markup
before and liked what I saw so let's see what this page specification:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification
PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<!-- generated by Spindle, http://spindle.sourceforge.net -->
<page-specification class="com.mjhenderson.tapestry.groovy.ScriptedMethodsPage">
<description><![CDATA[ Groovy-Tapestry Example Home Page ]]></description>
<property-specification name="formTitle" type="java.lang.String"/>
<property-specification name="formMessage" type="java.lang.String"/>
<context-asset name="stylesheet" path="css/style.css"/>
</page-specification>
Looks like in some (hypothetical) Groovy Markup:
import com.mjhenderson.tapestry.groovy.ScriptedMethodsPage;
page = builder.page(
description:"Groovy-Tapestry Example Home Page",
class:com.mjhenderson.tapestry.groovy.ScriptedMethodsPage.class) {
properties {
formTitle(type:"java.lang.String")
formMessage(type:"java.lang.String")
}
assets {
stylesheet(path:"css/style.css")
}
}
Now that's not so unpleasant to look at, is it? Plus I get the existence of the page class checked, it's not a string
but a class reference, and the page-specification is code so I can compile it and deploy it as a Java class if I want.
Posted: Thu - July 22, 2004 at 01:40 PM
|