Hi, Yes you can add an error-page tag your web.xml and throw an exception to the web container. You might however want to catch the exception in the validate method and morph it into an ActionError. I guess it depends if the user can do anything about the error. If they can't then I'd just throw an exception and have the container pass it to which ever page is specified by the error-page tag in my web.xml.
Jon. -----Original Message----- From: Jonathan James [mailto:[EMAIL PROTECTED]] Sent: 12 December 2001 12:59 To: Struts Users Mailing List Subject: Re: Help:Handling Exceptions within Formbean Validate ??? I don't see how that would work. If he just gets a normal validation problem, but no exceptions (the normal case) then he needs to go back to the jsp, not to some generic error.jsp. Isn't there a way to set up a generic exception handler page so that if the container catches an exception it forwards it to that page? I thought I remembered seeing something like that in this mailing list, but I can't find it now. Jonathan ----- Original Message ----- From: "Jon.Ridgway" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Wednesday, December 12, 2001 4:30 AM Subject: RE: Help:Handling Exceptions within Formbean Validate ??? > 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]> > > > > -- 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]>

