Proposed for XWork

One of the biggest disconnects I had when moving from Struts to WebWork (I really like WebWork) was getting a handle on the actions.xml file. To elaborate a little, when you declare an action in Struts you're using the fully qualified classname in the config file. The example actions.xml listed the action name and alias but it wasn't immediately clear how that name related to the action class it referred to. The lightbulb finally went off when I found the webwork.action.packages property in the default.properties file.

Part of it was probably a documentation issue (I just needed to read the docs better). Part of it was because the action packages are declared separately from the actual actions. It's that last part that prompted me to look for something more intuitive.

Ideally, what I'd like to see happen is have the property webwork.action.packages removed from default.properties (it's currently commented out) and moved to the view/action configuration file. As a first step, I'd like to extend the action.xml file to include a new tag (or tags) allowing the user to specify the package prefix there. Then update XMLActionConfiguration to check for the package prefixes and add them to the webwork.action.packages property. Here is an example of a possible action.xml file:

<actions>

<package prefix="webwork.action.standard" />
<package prefix="com.example.weblog.actions" />

<action name="entry.CreateEntry" alias="CreateEntry">
<view name="input">addentry.jsp</view>
<view name="error">addentry.jsp</view>
<view name="success">viewentry.jsp</view>
</action>

</actions>

Nothing in views.properties needs to be updated since the property can just be included there (Which I also think makes sense).

Removing webwork.action.packages from default.properties wouldn't really have a major impact since PrefixActionFactory already defaults to webwork.action.test and webwork.action.standard. So WebWork will work, as is, without this setting. What one is really configuring is the custom package prefix for your custom actions. I think it makes sense to keep these two configurations together in the same file from both a configuration and a documentation point of view.

On a somewhat related note, I think it would be great to specify all the WebWork configuration property names as constants in a single class/interface and refer to these constants in the code. I kept wanting to 'Find Usages' on these property names and couldn't. I would be more than happy to make just this change to the current WebWork classes, if others think it would be a good idea.

Comments? Questions?

- Brock

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus



-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to