Thank you Bill, your answer was correct. I've found that commons-validator as distibuted with the latest
1.2.1 version of struts doesn't include the http://jakarta.apache.org/commons/dtds/validator_1_2_0.dtd
file. So despite my specifying the DTD like so
snip=


<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_2_0.dtd";>
=snip


I've copied the following files over to my libs dir.

snip=
08/07/2004  09:26              358,273 antlr.jar
08/07/2004  09:26              118,726 commons-beanutils.jar
08/07/2004  09:26              165,119 commons-collections.jar
08/07/2004  09:26              109,096 commons-digester.jar
08/07/2004  09:26               22,379 commons-fileupload.jar
08/07/2004  09:26               38,015 commons-logging.jar
08/07/2004  09:26               84,260 commons-validator.jar
08/07/2004  09:26               65,425 jakarta-oro.jar
08/07/2004  09:26              520,842 struts.jar
=snip

It still appears to be still validating using an old dtd and throws the following exception.

wierd ... wierd ... wierd

15-Jul-2004 13:22:07 org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 30 column 21: The content of element type "field" mu
st match "(msg|arg0|arg1|arg2|arg3|var)*".
org.xml.sax.SAXParseException: The content of element type "field" must match "(
msg|arg0|arg1|arg2|arg3|var)*".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown S
ource)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)


at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknow
n Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1581)
at org.apache.commons.validator.ValidatorResources.<init>(ValidatorResou
rces.java:153)
at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPl
ugIn.java:233)
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java
:164)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServle
t.java:839)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1044)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:88
7)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3853)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
168)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:
2897)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardCo
ntext.java:4472)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
rocessChildren(ContainerBase.java:1658)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
rocessChildren(ContainerBase.java:1667)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p


I've tried getting the latest version from http://cvs.apache.org/builds/jakarta-commons/nightly/commons-validator/
and despite it including the 1.2 dtd the problem persists, perhaps I am brain dead but I can't figure this out.


--b

Bill Siggelkow wrote:

Are you using Struts 1.2 or the nightly build? I had this issue the other day and I think I got around it by using the new <arg> element instead of <arg0> -- simply change arg0 to arg in your validation.xml.

<arg key="label.oldPassword"/>

Or you can try using the new position attribute:

<arg key="label.oldPassword" position="0"/>

Bill Siggelkow


Bryan Hunt wrote:

I have the following jsp page
snip=
<html:errors/>
<table width="712" border="0">
<tr>
<td width="197">
<html:form action="/client-change-password-action">
<table>
<tr>
<th align="right"><bean:message key="label.oldPassword"/>:</th>
<td>
<html:text property="oldPassword"/>
</td>
etc etc etc
=snip


I have 4 struts config files default.xml,client.xml,admin.xml,sales.xml

They are declared as so in my web.xml file.
snip=
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts/default.xml,
/WEB-INF/struts/client.xml,
/WEB-INF/struts/sales.xml,
/WEB-INF/struts/admin.xml
</param-value>
</init-param>
=snip

The default.xml contains the following lines which work just fine for everything else
snip=
<message-resources parameter="ie.jestate.web.ApplicationResources"/>


<!-- Plug Ins Configuration -->

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tiles/default-defs.xml,/WEB-INF/tiles/client-defs.xml,/WEB-INF/tiles/sales-defs.xml,/WEB-INF/tiles/admin-defs.xml" />
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>


<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
=snip


My validation.xml file has the following relevant lines ...
snip=
 <form name="ClientChangePasswordForm">
           <field property="oldPassword" depends="required">
           <arg0 key="label.oldPassword"/>
           </field>
           <field property="newPassword" depends="required">
           <arg0 key="label.newPassword"/>
           </field>
           <field property="confirmNewPassword" depends="required">
           <arg0 key="label.confirmNewPassword" />
           </field>
       </form>
=snip

My ApplicationResources.properties file has the following content
snip=
label.oldPassword=Old Password
label.newPassword=New Password
label.confirmNewPassword=Confirm New Password
errors.required={0} is required.<br>
errors.minlength={0} cannot be less than {1} characters.<br>

=snip
Now everything works fine including the labels (ie <bean:message key="label.oldPassword"/> ) but when
the form is submitted but not all the fields are filled out I get the following messages ( output from <html:errors/>.


null is required.
null is required.
null is required.

Is this possibly a Struts bug or is it too late in the day and I drink to many units at the weekend being an Irishman ?

--b



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to