You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Bullard, James" <JB...@AR.SONY.COM> on 2004/06/08 22:26:08 UTC

form validation, assigning context

Is there anyway to declare that a validator should create ActionErrors under
a given key. For instance in my code I write something like this:

new ActionErrors("user-errors", new ActionError("errors.user.invalid",
username)); 

Then in the page (I am using velocity, but this is not important bear with
the code) I have something like this:

#displayErrorMarkup("user-errors") 

The problem is that when this macro goes and fetches the errors it uses the
key "user-errors" to fetch the errors, so errors which the validator
generated will not be displayed, I did not see anyway for a form element in
validation.xml to be declared with ActionErrors context key which I think is
quite necessary, so I am probably missing something simple.  


Thanks in advance, 

jim

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: form validation, assigning context

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
No is the short answer, but theres nothing to stop you storing them in the
request under your own key as well in your ActionForm's validate method.

Niall

----- Original Message ----- 
From: "Bullard, James" <JB...@AR.SONY.COM>
To: <us...@struts.apache.org>
Sent: Tuesday, June 08, 2004 9:26 PM
Subject: form validation, assigning context


> Is there anyway to declare that a validator should create ActionErrors
under
> a given key. For instance in my code I write something like this:
>
> new ActionErrors("user-errors", new ActionError("errors.user.invalid",
> username));
>
> Then in the page (I am using velocity, but this is not important bear with
> the code) I have something like this:
>
> #displayErrorMarkup("user-errors")
>
> The problem is that when this macro goes and fetches the errors it uses
the
> key "user-errors" to fetch the errors, so errors which the validator
> generated will not be displayed, I did not see anyway for a form element
in
> validation.xml to be declared with ActionErrors context key which I think
is
> quite necessary, so I am probably missing something simple.
>
>
> Thanks in advance,
>
> jim
>
> ---------------------------------------------------------------------
> 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