views:

111

answers:

1

We are using ICEFaces 1.8 and I would like to perform a forward to a new URL, but want it to open in a new window. We are currently able to perform a redirect to a new window as:

public static void redirectToUrl(String urlPath) {
    if (urlPath != null) {
        try {
            final String url = FacesUtil.getContextPath() + urlPath;

            final StringBuffer jsCommand = new StringBuffer();
            jsCommand.append("window.document.location.href='").append(url).append("';");

            JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), jsCommand.toString());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

But is a forward possible using a similar approach?

A: 

Try window.open(url).

SLaks
Is that issuing a new request though? I am losing data on the screen that opens the new window. The reason I want to do it this way is because our backing-beans are all in request scope and any redirect is causing my bean to go out of scope. Using a navigation rule actually keeps my data in scope since its performing a forward. However, I want this to open in a new window, not replace the contents of the current browser window.