Martin Gladdish

Software 'n' stuff

Global Object in Tapestry 4.1

It’s no longer necessary to configure the Global object in the app’s .application file. Instead, the Global object is now managed by Hivemind. So, insert the following to your hivemodule.xml:

1
2
3
4
5
<contribution configuration-id="tapestry.state.ApplicationObjects">
  <state-object name="globalObject" scope="application">
    <create-instance class="com.company.project.tapestry.MyGlobalObjectClass"/>
  </state-object>
</contribution>

And then this object can be injected into your page classes with the following:

1
2
@InjectState("globalObject")
public abstract MyGlobalObjectClass getGlobal();

Tapestry Investigation

Well, it’s time to start delving into Tapestry once again, so I’ll be detailing my experiences here. The first thing that strikes is that the documentation for Tapestry 4 is thin. When looking into Tapestry previously, I bought Howard’s book for Tapestry 3 which I found very useful. Unfortunately the framework has changed significantly since then and there hasn’t been a new edition of the book. This has created a gap which a few others have attempted to fill, but they seem to fall short of the mark. Enjoying Web Development With Tapestry is a game attempt, but is typeset and structured much more like an online tutorial than a textbook. For example, the first chapter opens with instructions (with detailed screenshots) for how to install Eclipse. Frankly, if you need help installing an IDE, then a textbook on complex web frameworks isn’t for you. On the plus side, it has got me out of a tight spot when trying to solve a non-obvious problem with form validation delegates. More of this in a later post.