On 5/3/07, Dave Newton <[EMAIL PROTECTED]> wrote:
Hey,

Working on an S1 app at the moment (shaddup, all a'
ya').

Things are set up a bit weird compared to what I'm
used to; in this case there's an action that uses an
ActionForm that isn't declared in struts-config, and
that ActionForm contains nested ActionForms.

I need to do some validaton on one of the nested
ActionForms and would prefer to put it in
validation.xml, but since neither the parent nor child
forms are declared in struts-config I'm not sure I can
do this.

AFAIK the only link to the struts-config.xml is the ActionMapping
passed to the validate method - which is used in the
getValidationKey() method to determine the "form name" defined in your
validation.xml

My naive implementation (define the sub-form
validation in validation.xml and call
subForm.validate(mapping, request) throws an NPE from
inside ValidatorForm.validate().

Which line is it failing on (and which Struts version)? My guess is
if, as you say, no forms are defined in the struts-config.xml then the
"attribute" value of the ActionMapping is null - probably causing your
NPE. So either override the getValidationKey() method in your action
form - or create your own dummy ActionMapping with the "attribute" set
to the name of the form defined in your validator.xml for the
validations you want executed.

Niall

I've never really even thought of doing anything this
way so I'm unfamiliar with how struts-config and
validation.xml interact (or if they do).

All the forms
seem to be instantiated by hand etc. so... I'm afraid
I have to do the validation by hand (which would suck,
because there's a wad of intRanges and validwhens and
the version of validator they're using doesn't seem to
have all the standalone validation routines).

I'm just wondering if what I want to do is (reasonable
and) possible.

- make sure whatever action mapping has the appropriate value

Thanks,
Dave


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------------------------------------------------
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