You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oleg V Alexeev <go...@penza.net> on 2000/11/22 23:39:25 UTC

Re[4]: thought on design

Hello Pierre,

Wednesday, November 22, 2000, 6:10:27 PM, you wrote:

PM> Hi Neg,
>> PM>     if (!validA(fieldA))
>> PM>     {
>> PM>         errors.add("fieldA", new
PM> ActionError("classX.fieldA.notValid"));
>> PM>     }
>> PM>     ...
>> PM>     return result;
>> PM> }
>>
>> How would it be written to browser?
>> As "fieldA" - <error message from locale package> ?
>> Or i18n can be applied to field name too?

PM> "fieldA" is a constant key to map errors in the ActionErrors collection, so
PM> you can decide what to do with them.
PM> "classX.fieldA.notValid" is a key to find the appropriate error message in
PM> your resource file (i18n applied).

PM> There's no way for now to render the error to the browser. What is missing
PM> is something like <form:error name="fieldA" /> that would display the
PM> associated error message on your form. You can try to write it and propose
PM> your code for 1.0 inclusion...

PM> Pierre Métras

I already have one.. 8)) It takes parameters -
 name - name of attribute with errors
 property - source of error message
 key - key to retrieve message from resource bundle
 
ErrorTag uses ActionErrorsExt - I post this class some hours ago, with
the classes for extended errors rendering.

-- 
Best regards,
 Oleg                            mailto:gonza@penza.net