What version of Struts are you using? If its Struts 1.2.7, then it is
possible to do this - Commons Validator 1.1.4 had "bundle" and "resource"
attributes added which enable you to specify alternate resource bundles. If
you look at Strut's FieldChecks class, which contains all the standard
validators which do this.

Niall

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
Sent: Tuesday, October 04, 2005 4:09 PM


Well, I've already tried to change the key of my message ressources but it
seems that it doesn't change anything.

Because I add errors from a validator plugin class, which is coded in java
inside my application, I cannot specify the key of my message ressource,
like if I was in the jsp page using the bean:write tag.

Is there any way to explicitly specify which ressource key to use when we
add error messages from a java class used by the validator framework ?

-----Message d'origine-----
De : Martin Gainty [mailto:[EMAIL PROTECTED]
Envoyé : 4 octobre 2005 10:54

Bonjour Luc-
the key characteristic (for message-resources) must be a unique identifier.
Right now they are the same (org.apache.struts.action.MESSAGE)
Bon Chance/HTH,
Martin-

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
Sent: Tuesday, October 04, 2005 10:06 AM


Hi there,

I need to add multiple message ressources to an application and to access
them from a custom validation class created with the validator framework.

I've added the following in struts-config.xml :

--------------------------------------------------------------------------
<message-resources key="org.apache.struts.action.MESSAGE"
parameter="ca.uquebec.sid.trousse.mvc.parameters.MessageResources"
null="false" />

<message-resources key="org.apache.struts.action.MESSAGE"
parameter="ca.uquebec.sid.utils.ValidationProgramme" null="false" />
--------------------------------------------------------------------------

.. and my message is added with the following code :

--------------------------------------------------------------------------
errors.add(field.getKey(), new ActionMessage("Message.key"));
--------------------------------------------------------------------------

.. but my application can only find the messages located in the second
ressource.

How can I use both message ressources with the validator framework and
custom validation classes ??



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

Reply via email to