It might have something to do with the error coming from your constructor. That is, its happening when JSF is initializing your managed beans. I would say use a debugger to figure out who's calling your constructor. If it isn't happening inside the FacesServlet, then most JSF things won't work. This might indicate a MyFaces problem.
On Mon, 6 Dec 2004 10:37:05 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Heath, > > I tried your solution #1, and I keep getting the same result > as in my previous post, ie: the redirect or dispatch calls are ignored > and jsf tries to render the current jsp. I scanned the specs, as suggested, > but found nothing (that I understood) which explains the current behaviour. > > Is there really no way to take control over naviagation in JSF and return a > specific page ? > > > I'm surprised, I would have thought that most applications would have to > deal with > this dilemma. JSF, being what it is with the BBean pattern, I would have > thought > that most apps would load data from the backend via BB constructors and have > to > handle errors there when something went wrong on the backend.... > > I believe that setting up an error page via web.xml will have to do, > unfortunately. > > Thanks for your help ! > > Mark > > > > -----Message d'origine----- > De : Heath Borders [mailto:[EMAIL PROTECTED] > Envoy� : vendredi 3 d�cembre 2004 15:07 > > > � : MyFaces Discussion > Objet : Re: Error handling & redirecting from BB constructor possible ? > > > > > > Well, this should work. Look at the JSF 1.1 API for further details, but > here are some things that could be going wrong: > > 1. FacesContext.getCurrentInstance().getExternalContext().redirect(String) > already called FacesContext.responseComplete(), so you don't need to call > FacesContext.renderResponse(), though this shouldn't matter 2. > FacesContext.getCurrentInstance().getExternalContext().redirect(String) > > needs the absolute URI you are redirecting to. If you provide the wrong > URI, I don't know what will happen. > > If you're still dead set against using > FacesContext.getCurrentInstance().getExternalContext().redirect(String) > you could just set up an error page in your web.xml for the exception, > though this may not be optimal. > > > On Fri, 3 Dec 2004 14:48:07 -0500, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > > > > > Heath, > > > > I tried this also (but forgot to mention), followed by > > "FacesContext.getCurrentInstance().responseComplete()" > > but the request keeps processing the same jsp & the redirect never > happens. > > > > Is there any other way to handle errors inside BB constructor ? > > In other words, I would expect most apps to have to deal with this... > > > > > > > > > > > > -----Message d'origine----- > > De : Heath Borders [mailto:[EMAIL PROTECTED] Envoy� : vendredi > > 3 d�cembre 2004 14:22 � : MyFaces Discussion Objet : Re: Error > > handling & redirecting from BB constructor possible ? > > > > > > > > Call > > FacesContext.getCurrentInstance().getExternalContext().redirect(String > > ) > > > > > > On Fri, 3 Dec 2004 13:24:13 -0500, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > > > > > Does anybody know how to go about redirecting to an error page from > > > the constructor of a backing bean. > > > > > > For example: > > > > > > class BBean > > > { > > > Data someData; > > > > > > public BBean () > > > { > > > try > > > { > > > someData = getData(); > > > } > > > catch(Throwable t) > > > { > > > // What is the code here to redirect to an error page ? > > > } > > > } > > > > > > .... > > > } > > > > > > I tried using > > > FacesContext.getCurrentInstance().getExternalContext().dispatch("err > > > or .jsp"); but I got a response already rendered error. > > > > > > Thanks > > > > > > Mark > > > > > > -- > > If you don't have a GMail account, I probably have 5 invites. Just ask! > > -Heath Borders-Wing > > [EMAIL PROTECTED] > > > -- > If you don't have a GMail account, I probably have 5 invites. Just ask! > -Heath Borders-Wing > [EMAIL PROTECTED] -- If you don't have a GMail account, I probably have 5 invites. Just ask! -Heath Borders-Wing [EMAIL PROTECTED]

