If you want to redirect a user to another XPage you can use the redirectToPage function:
context.redirectToPage( "someXPage.xsp" ); context.redirectToPage( "someXPage" );
You can also add parameters to this call if you need to:
context.redirectToPage( "someXPage.xsp?action=openDocument" ); context.redirectToPage( "someXPage?action=openDocument" );
If you want to redirect the user to another site, you can use the redirect method:
All of the methods above send a “redirect” page to the browser with a 302 status code (“moved temporarily”) that includes the new location in the header. Next, the browser will perform a HTTP GET to the new location. The location in the address bar of the browser is updated and the browser displays the new page.
A disadvantage of using a client-side redirect is that it causes an extra HTTP request to be performed by the browser. There is also another method called a “forward”. Using a forward, the request forwarding is done internally by the server. The results of the internal forward (the contents of the new page) are send back directly to the browser. The browser doesn’t know of the internal forward and won’t update the URL in the address bar.
The perform a server side forward you need to add a second parameter to the redirectTo method:
context.redirectToPage( "someXPage.xsp", false);