Hi Greg,

Try setting validate=true and input=<generic error.jsp> in your action
mapping. This way if your form bean returns ActionError(s) Struts will
return to the named input form to display errors (see html:error tag).

Jon.


-----Original Message-----
From: Greg Callaghan [mailto:[EMAIL PROTECTED]] 
Sent: 12 December 2001 00:06
To: [EMAIL PROTECTED]
Subject: Help:Handling Exceptions within Formbean Validate ???

Hi,

With struts how is one supposed to handle exceptions which are caught within

the validate method of a formbean?  That is, how can you from here go to 
ones generic error page?

Background - I have a case where the form (eg create new X) has some pull 
down lists which are dynamically generated.  If the validate for the form 
fails therefore and I need to go back to the input jsp page with error, I DO

NEED TO re-extract the dynamic pull down list data from within the validate 
method before it finishes (unless there is a better way?).  If the database 
is down during this phase however an exception is caught within the validate

method.  Also as my JSP page expects the data present I get a null pointer 
exception in this situation hence the need to redirect to the normal error 
page I use for exceptions.  Question is how to make this happen from within 
the validate method of the formbean?

Any advice welcome.

PS - I tried including a *.do for the input mapping, rather than the .jsp 
mapping, however the problem here the recent changes in the form (eg if you 
were doing an edit form) are not remembered.  Eg if title was "xyz", then I 
changed it to "", this causes a validation error but when going back to the 
page via the action (cf directly to JSP) the end result is "xyz" is 
displayed not "".

Regards
Greg

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to