struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Stace <s45652...@yahoo.com>
Subject Re: Forwarding if Validation Fails
Date Sat, 09 Feb 2002 13:56:33 GMT
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:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message