You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Albrecht Leiprecht <al...@t-online.de> on 2005/08/10 21:23:21 UTC
Validator...the 1001st question...
Hi all,
I'm curious ... shouldn't it be possible to override the
default error message assigned to a validator rule ?
Here's the example:
validator.xml
[...]
<field depends="validwhen" property="salutation">
<msg name="testmsg" key="error.saluation.makechoice"/>
<arg key="label.salutation" position="0"/>
<var>
<var-name>test</var-name>
<var-value>(*this* != "u")</var-value>
</var>
</field>
[...]
validator-rules.xml
[...]
<validator name="validwhen"
msg="errors.required"
classname="org.apache.struts.validator.validwhen.ValidWhen"
method="validateValidWhen"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"/>
[...]
I understand, that the "errors.required" is the default msg. And
thats exactly what gets shown in case of an error. Am I stupid
or shouldn't it show "error.saluation.makechoice" instead ??
scratching his head
albi
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Validator...the 1001st question...
Posted by Albrecht Leiprecht <al...@t-online.de>.
and .... yes .... I am ....
[...]
<field depends="validwhen" property="salutation">
<msg name="testmsg" key="error.saluation.makechoice"/>
<arg key="label.salutation" position="0"/>
<var>
<var-name>test</var-name>
<var-value>(*this* != "u")</var-value>
</var>
</field>
[...]
Should be
[...]
<field depends="validwhen" property="salutation">
<msg name="validwhen" key="error.saluation.makechoice"/>
<arg key="label.salutation" position="0"/>
<var>
<var-name>test</var-name>
<var-value>(*this* != "u")</var-value>
</var>
</field>
[...]
If I want to override it's default error message ;)
Stopped scratching his head ....
albi
-----Original Message-----
From: Albrecht Leiprecht [mailto:aleiprecht@t-online.de]
Sent: Wednesday, August 10, 2005 9:23 PM
To: 'Struts Users Mailing List'
Subject: Validator...the 1001st question...
Hi all,
I'm curious ... shouldn't it be possible to override the
default error message assigned to a validator rule ?
Here's the example:
validator.xml
[...]
<field depends="validwhen" property="salutation">
<msg name="testmsg" key="error.saluation.makechoice"/>
<arg key="label.salutation" position="0"/>
<var>
<var-name>test</var-name>
<var-value>(*this* != "u")</var-value>
</var>
</field>
[...]
validator-rules.xml
[...]
<validator name="validwhen"
msg="errors.required"
classname="org.apache.struts.validator.validwhen.ValidWhen"
method="validateValidWhen"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"/>
[...]
I understand, that the "errors.required" is the default msg. And
thats exactly what gets shown in case of an error. Am I stupid
or shouldn't it show "error.saluation.makechoice" instead ??
scratching his head
albi
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org