You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Anton Gavazuk <an...@gmail.com> on 2009/10/24 13:32:14 UTC

How to make redirect to page with another context?

Hi all,

actually, question is in the subject: How to make redirect from JSF
application to a page with another context, like www.google.com

Thanks,
Anton

Re: How to make redirect to page with another context?

Posted by Anton Gavazuk <an...@gmail.com>.
Hi Richard,
thanks

I knew about that method but I was trying to redirect incorrect URL like "
www.google.com".
to make redirect works URL must be in full form: "http://www.google.com".
I hope noone will make the same mistake :)


2009/10/24 Richard Yee <ri...@gmail.com>

> If you want to do it programmatically from an action,
> You can try this method
>
> /**
> * Redirect to a new url
> * @param url an external url
> */
> void redirect(String url) throws IOException{
> FacesContext facesContext = FacesContext.getCurrentInstance();
> ExternalContext externalCtx = facesContext.getExternalContext();
> externalCtx.redirect( url);
> }
>
> -Richard
>
>
> On Sat, Oct 24, 2009 at 4:32 AM, Anton Gavazuk <an...@gmail.com>
> wrote:
> > Hi all,
> >
> > actually, question is in the subject: How to make redirect from JSF
> > application to a page with another context, like www.google.com
> >
> > Thanks,
> > Anton
> >
>

Re: How to make redirect to page with another context?

Posted by Richard Yee <ri...@gmail.com>.
If you want to do it programmatically from an action,
You can try this method

/**
* Redirect to a new url
* @param url an external url
*/
void redirect(String url) throws IOException{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalCtx = facesContext.getExternalContext();
externalCtx.redirect( url);
}

-Richard


On Sat, Oct 24, 2009 at 4:32 AM, Anton Gavazuk <an...@gmail.com> wrote:
> Hi all,
>
> actually, question is in the subject: How to make redirect from JSF
> application to a page with another context, like www.google.com
>
> Thanks,
> Anton
>