Hi,

The problem with morphing it into an ActionError is that, as the problem the 
dynamic list wasn't created, the JSP page will not find its normal expected 
dynamic list and error out.  With struts it seems what happens in this case 
(ie tag errors) the user ends up getting a blank screen.

I have a JSP page for caught exceptions which I go to via a global forward, 
and for which the JSP page expects struts errors (ie users struts error 
tag).  However in this case I don't think I'm in a position in the formbean 
to do a global forward.

Throwing an exception and letting my generic error page (ie for un-caught 
exceptions) seems a good suggestion (thanks - should have thought of this).  
In fact I guess I'll be able to still use the struts error tags (hadn't 
considered this).(?)  I'll give this a go.

Cheers
Greg
----Original Message Follows----
From: "Jon.Ridgway" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: Help:Handling Exceptions within Formbean Validate ???
Date: Wed, 12 Dec 2001 13:20:33 -0000

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





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

Reply via email to