struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cosyns Xavier" <xcos...@noctis.be>
Subject RE: How appropriately access message-resources from Form classes??
Date Fri, 04 Jun 2004 09:55:52 GMT
It's for field validation purposes,

Eg: 
Error.mandatory=Attribute {0} is mandatory.
Key.field.one=name
Key.field.two=description
Etc...

The validator framework does it, but I got forms that needs quite more
complicated and conditionally validations that I can not do with the
validator framework.



>
>Call me nosy here, What sort of values would you want 
>internationalized this way?
>
>I would think that the parameters should be just that -- 
>parameters. Essentially you "should" be trying to fill in the 
>blank in some string. At least that's what the framework envisions...
>
>Ex:
>
>My name is {0}
>
>Or
>
>Me llamo es {0}
>
>Does it matter to your app if {0} is Joe or Jose'? Is it not 
>something you can handle in the message text itself?
>
>Kind of curious now...
>
>-Joe
>
>> -----Original Message-----
>> From: Cosyns Xavier [mailto:xcosyns@noctis.be]
>> Sent: Friday, June 04, 2004 5:23 AM
>> To: Struts Users Mailing List
>> Subject: How appropriately access message-resources from Form 
>> classes??
>> 
>> 
>> Hi,
>> 
>> I want to do some custom validation inside my ValidatorForm
>> but encountered some problems in displaying in a 
>> 'struts-recommended way' my error messages.
>> 
>> From inside a ValidatorForm I can not find a way to access
>> the resource bundles configured in the struts config file. I 
>> need it because I want to create an actionError with 
>> internationalized arguments.
>> 
>> Something like this:
>> ActionError("my.error.key", getResourceValue("my.first.arg.key"),
>> getResourceValue("my.second.arg.key"));
>> 
>> But I do not know how to access my properties in a 'struts'
>> way inside my ValidatorForm.
>> 
>> With Action there are no problems as we have a getResources() method.
>> 
>> Does anyone have some idea about this,
>> 
>> Thanks,
>> 
>> Cosyns Xavier,
>> ______________________________ 
>> xcosyns@inveo.be 
>>  
>> InveO Consulting & Development
>> Av. E. de Beco 112
>> 1050 Ixelles
>> Tel: +32 2 648 74 32 
>> Fax: +32 2 648 87 64 
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message