Dave Johnson on open web technologies, social software and software development
« Custom systems devel... | Main | Roller 0.9.7.5 progr... »
It's a nice coincidence that the very week that I have to dig into the Struts Validator, two articles appear by Erik Hatcher on XDoclet and Struts. After reading these articles and browsing Matt Raible's AppFuse project code, I was able to fit the pieces together and get XDoclet to generate the right struts-config.xml
and validation.xml
entries for my form beans. Below are links to Erik's articles and some other resources I found useful in investigating Struts Validation:
Seems like everytime I try to use XDoclet, I have to tweak one of the XDoclet template files to work around a bug. This time was no exception. I found that XDoclet would only generate the right entries in struts-config.xml
if my form beans extend ActionForm, but to use the Struts Validator, I need my form beans to extend ValidatorForm. The only way I found to get around this problem was to copy struts_config_xml.xdt
out of the XDoclet xdoclet-apache-module-1.2b4.jar
file and to change the first forAllClasses
like so (my change in bold):
<!-- ========== Form Bean Definitions ============== --> <form-beans>
<XDtClass:forAllClasses type="org.apache.struts.validator.ValidatorForm"> <XDtClass:forAllClassTags tagName="struts:form" superclasses="false"> <form-bean name="<XDtClass:classTagValue tagName="struts:form" paramName="name"/>" type="<XDtClass:fullClassName/>" /> </XDtClass:forAllClassTags> </XDtClass:forAllClasses>
I believe there needs to be one of those forAllClassses
loops for each type of form: ActionForm
, ValidatorForm
, and ValidatorActionForm
. This does not appear in the current XDoclet CVS for <a href=
"http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xdoclet/xdoclet/modules/apache/src/xdoclet/modules/apache/struts/resources/struts_config_xml.xdt?rev=1.11&content-type=text/vnd.viewcvs-markup">
struts_config_xml.xdt
. My chance to get a patch in?
Dave Johnson in Java
03:37AM Aug 01, 2003
Comments [4]
Tags:
Java
« Custom systems devel... | Main | Roller 0.9.7.5 progr... »
This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog
Below are the most recent entries in the category Java, some may be related to this entry.
Posted by Erik Hatcher on August 01, 2003 at 07:38 PM EDT #
Posted by Dave Johnson on August 01, 2003 at 08:15 PM EDT #
Posted by Joshua Davis on January 11, 2004 at 03:11 PM EST #
Posted by Tim Chen on February 05, 2004 at 03:58 AM EST #