Webwork+XDoclet 1.2 beta+ANT+Resin == Rapid Prototyping City

This is somewhat sketchy on the details, but I wanted to get it out there while it was fresh in my mind.

How to iteratively prototype a webapp:-

Get Webwork and import it into your project.

Slap together an ANT script that compiles your stuff and WARs it up, puts the web.xml file from webwork in WEB-INF and includes webwork.jar in your WEB-INF/lib folder. Add an extra line to copy your WAR to your servlet container’s webapps directory.

Build at least one class that extends ActionSupport. Override execute() to return Action.SUCCESS.

Put a class-level javadoc comment that looks something like this in it:


* @webwork.action

*   name="myCoolAction"

*   input="myInput.jsp"

*   success="myCoolActionSuccess.jsp"


Write a simple jsp called myInput.jsp with an input form along the lines of:-

FORM METHOD="POST" ACTION="myCoolAction.action"

Write a quick success.jsp page with a ‘well done’ or similar message.

Get XDoclet 1.2 beta. Stick the jars in Ant’s classpath. Add a target that look like this:-

<target name="xdoclet" depends="init"










addedtags="@xdoclet-generated at ${TODAY}, XDoclet,@version ${version}"



<fileset dir="${src.java}">

<include name="**/*Servlet.java"/>

<include name="**/*Filter.java"/>

<include name="**/*Tag.java"/>

<include name="**/*Action.java"/>


<webWorkConfigProperties destDir="${webinf.classes}"/>



Include the target into your default build, just before the compilation step.

Run ANT. Wait for resin to reload your webapp.

Open /yourWebapp/myInput.jsp. Submit it. See the success.jsp page. Modify your Action class’s execute() method to actually do something, like check for the right name/value pairs. Make it return Action.INPUT to go round again, Action.SUCCESS to succeed and go to success.jsp, Action.ERROR to report an error etc.


More details when I have time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s