How are you displaying the errors with? Using <html:errors/> or
<html:messages/>, If so, define how many message-resources you would like to
have for your application (identifiable with unique keys) and use the
appropriate "bundle" attributes on the <html:errors/> and <html:messages/>
tags which refer to the <message-resources> keys.

On 10/4/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> The validations that I included in my validation class are custom made and
> are using an Oracle connection to perform complicated validations which are
> stored in a Validation Servlet. I'm not using the standard validations that
> comes with Struts.
>
> My validation Servlet instanciates a generalised validation class which
> posses it's own message ressources and when I launch a validation, it
> returns null if it's valid or throws an exception containing a message key
> if an error is encountered. This message key is then added to the validator
> framework's errors to display via :
>
> catch (ValidationException exception)
> {
> errors.add(field.getKey(), new ActionMessage(exception.getMessage()));
> }
>
> I can only access one message ressource from my struts-config.xml and it's
> either the last one I've defined using the
> org.apache.struts.action.MESSAGE key for both or no one at all if I define
> any other key for both.
>
>
>
> ____________________________
> Luc Boudreau
> SID - Université du Québec
> [EMAIL PROTECTED]
>
>
> -----Message d'origine-----
> De: Niall Pemberton [mailto:[EMAIL PROTECTED]
> Envoyé: 4 octobre 2005 11:30
> À: Struts Users Mailing List
> Objet: Re: Question about validator and multiple message ressources
>
> 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]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to