You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Co...@hydro.qc.ca on 2004/12/03 19:24:13 UTC

Error handling & redirecting from BB constructor possible ?

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("error.jsp")
;
but I got a response already rendered error.
 
Thanks
 
Mark

Re: Error handling & redirecting from BB constructor possible ?

Posted by Heath Borders <he...@gmail.com>.
Call FacesContext.getCurrentInstance().getExternalContext().redirect(String)


On Fri, 3 Dec 2004 13:24:13 -0500, cote.mark@hydro.qc.ca
<co...@hydro.qc.ca> 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("error.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
hborders@mail.win.org