I normally use the DynaValidator stuff so I haven't run into this, but
I'm writing up a lesson using a standard ActionForm with a validate
method.

In the validate method I have as an example:

if ( getName() == null || getName().length() < 1 ) {
    errors.add("name",new ActionError("error.name.required"));
}

But what if I wanted to set up a global.required and wanted to pass in
"Name." I of course understand I could do:

if ( getName() == null || getName().length() < 1 ) {
    errors.add("name",new ActionError("error.name.required", "Name"));
}

but this creates problems if you want internationalization since you are
hardcoding in the word "Name." I'd like to do:

errors.add("name",new ActionError("error.name.required",
messages.getMessage("name") ));

but I'm blanking on a way to get a handle to MessageResources within an
ActionForm. 

Within in Action I can see how to do it ( getResources( request ) ) but
I can't see how to get this in an AcionForm since Action getReources is
protected in the actions package.

Thanks for any help,

(I did search the archives and someone else asked this but I didn't see
an answer posted).

-- 
Rick

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

Reply via email to