For those that care,

I wrote (see attachment) an XDoclet Template to produce an actions.xml file
for WebWork. It might be nice to get this, or something like this integrated
into 1.2 before final release (not sure of how or if this can be done).
Ideally a new tag/ task class (not <webworkconfigproperties>) should be used
as to not need overriding the templateFile and destinationFile. It would
extend XmlSubTask, etc.

Here is how it works as of now. Hopefully it will help someone.

In your build file:
   <webworkconfigproperties
    destdir="${classes}"
    templateFile="${xdoclet.merge.dir}/webwork_actions.xdt"
    destinationFile="actions.xml"
   />

It operates on the following tags.

Class Tag: @webwork.action
Params:  name, success, input, error

Method Tag: @webwork.command
Params: name, success, input, error
Comment: If name is not specified it takes a method called "doSave" and
makes the name "save"

Class AND/OR Method Tag: @webwork.view
Params: name, value

Examples:
Class Tag:
/**
 * @webwork.action
 *    name="document"
 *    error="/error.jsp"
 * @webwork.view name="test" value="one.jsp"
 * @webwork.view name="test2" value="two.jsp"
 */

Method tag:
 /**
  * @webwork.command
  *    success="/document/documentViewer.jsp"
  * @webwork.view name="foo" value="one.jsp"
  * @webwork.view name="bar" value="two.jsp"
  */


Produces the following actions.xml:
<?xml version="1.0" encoding="UTF-8"?>
<actions>

 <action name="xxx.action.DocumentAction" alias="document">
  <view name="error">/error.jsp</view>
  <view name="test">one.jsp</view>
  <view name="test2">two.jsp</view>

  <command name="save" alias="document!save">
   <view name="success">/document/documentViewer.jsp</view>
   <view name="foo">one.jsp</view>
   <view name="bar">two.jsp</view>
  </command>

 </action>

</actions>

Thanks,
Frank

Attachment: webwork_actions.xdt
Description: Binary data

Reply via email to