struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Starr <b.st...@qut.edu.au>
Subject Re: exception handling in actionForm validate method
Date Wed, 22 Jan 2003 04:01:34 GMT
> In the validate method of my actionForm I am using the Jakarta regular
> expression api to validate user input.
> 
> In the method I use a try catch block when creating a RE (regular expression
> pattern) object. In the event an exception is thrown the catch block will
> catch the exception-- but how do I propagate the exception out to the action
> where I can forward to an appropriate error page.  Or am I going at this all
> wrong.
> 
> Thanks for your help.

You need to populate and return an ActionErrors object with one or more
error messages relevant to the exception that is thrown. Provided you have
set up the page correctly the user will be redirected back to the form and
the error message(s) displayed in place of the <html:errors/> tag.

Ben Starr


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