You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jose Manuel Valladares <jm...@miraiespana.com> on 2006/02/21 18:31:30 UTC

Change status code returned when validate fails

Hello everybody,
In our app we would like to return another status code when the 
validation fails in the ActionForm.
Instead of forwarding to the error page and return 200 we would like to 
return 202 in some cases.

Is it possible to do this?

In the execute of the Action is possible because it includes the 
response as a parameter, but this is not the case with the ActionForm.

Any help would be greatly appreciated.

Thank  you very much for your time,
                            Manuel Valladares

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


Re: Change status code returned when validate fails

Posted by Michael Jouravlev <jm...@gmail.com>.
On 2/21/06, Jose Manuel Valladares <jm...@miraiespana.com> wrote:
> Hello everybody,
> In our app we would like to return another status code when the
> validation fails in the ActionForm.
> Instead of forwarding to the error page and return 200 we would like to
> return 202 in some cases.
>
> Is it possible to do this?
>
> In the execute of the Action is possible because it includes the
> response as a parameter, but this is not the case with the ActionForm.
>
> Any help would be greatly appreciated.

Do not use automatic validation, set "validate=false" in your action
mapping. Do not use "input" attribute of an action mapping.

By turning autovalidation off your Action.execute() will always get
called, so you can return whatever you like.

Michael.

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