You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antony Stace <s4...@yahoo.com> on 2002/02/09 14:56:33 UTC
Re: Forwarding if Validation Fails
Hi
>Override the ActionForm validate method in your form bean.
>
>If you need to to extra checks in the Action perform method, then
>you can configure an "input" for the action in struts-config.xml:
>
> <action path="/create"
> type="..."
> name="createForm"
> input="/WEB-INF/jsp/create.jsp"
> scope="request">
></action>
>
>then use this in the perform:
>
>if( ! validationTest() )
>{
> // add error here
> return new ActionForward( mapping.getInput() );
>}
I want to use this a validationTest() approach but am not sure how to use
it in my case. I don't want to have this logic in the ActionForm since
the logic is quite long to work out if the data is valid.
I have a AddNewUserDetails page in my application
and if a admin user enters a new user with a userName which is already used
then I want to
1. Create an ActionError and add this to the errors in this Action using
saveErrors()
2. Delete the value of userName in the ActionForm(so when the AddNewUser
is displayed again the userName field is not filled in, but blank)
Once these are done, I will return the user to AddNewUserDetails page by way of
the getInput() method.
What is the best way to go about this?
Thanks
Tony
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Forwarding if Validation Fails
Posted by Duncan Harris <du...@sapio.co.uk>.
s45652001@yahoo.com (Antony Stace) wrote:
> I want to use this a validationTest() approach but am not sure how to use
> it in my case. I don't want to have this logic in the ActionForm since
> the logic is quite long to work out if the data is valid.
> I have a AddNewUserDetails page in my application
> and if a admin user enters a new user with a userName which is already used
> then I want to
>
> 1. Create an ActionError and add this to the errors in this Action using
> saveErrors()
> 2. Delete the value of userName in the ActionForm(so when the AddNewUser
> is displayed again the userName field is not filled in, but blank)
>
> Once these are done, I will return the user to AddNewUserDetails page by way of
> the getInput() method.
>
> What is the best way to go about this?
What are you specifically stuck with?
You seem to have described all the steps.
Duncan Harris
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hartford, Cheshire, U.K., Tel: 07968 060418
Looking for STRUTS contract work in the U.K.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>