Pushing the envelope

Darren's take on Java, agile methods, cool open source stuff, interesting technologies and other random wanderings through the land of blog.
Updated: 26/01/2003; 11:49:00.
Places to go
Apache Jakarta Project
c2.com
ExtremeProgramming.org
OpenSymphony
XProgramming.com
XP Developer

People to see
Russell Beattie
Eugene Belyaev
Tony Bowden
Mike Cannon-Brookes
Jeff Duska
Paul Hammant
Scott Johnson
Brett Morgan
Rickard Öberg
James Strachan
Joe Walnes

Things to do

Subscribe to "Pushing the envelope" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.


That was the day
October 2002
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Sep   Nov



Archives
December 2002
November 2002
October 2002
September 2002
August 2002

Listening To


Valid RSS

Click here to visit the Radio UserLand website.

  27 October 2002

WebWorking

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"
  <taskdef
    name="webdoclet"
    classname="xdoclet.modules.web.WebDocletTask"
    classpathref="class.path"
    />
    <webdoclet
      destdir="${build}/src"
      mergedir="parent-fake-to-debug"
      excludedtags="@version,@author,@todo"
      addedtags="@xdoclet-generated at ${TODAY}, XDoclet,@version ${version}"
      verbose="false"
      >
      <fileset dir="${src.java}">
        <include name="**/*Servlet.java"/>
        <include name="**/*Filter.java"/>
        <include name="**/*Tag.java"/>
        <include name="**/*Action.java"/>
      </fileset>
      <webWorkConfigProperties destDir="${webinf.classes}"/>
    </webdoclet>
  </target>

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.

Repeat. More details when I have time.


4:43:15 PM      comment []

© Copyright 2003 Darren Hobbs