One way of invoking JavaScript call from bean and invoking a URL / TaskFlow in new window Tab
Following snippet is way to invoke JavaScript from bean, which accepts url as an input parameter
StringBuffer sb = new StringBuffer();
sb.append("var winPop = false;");
sb.append("if(winPop && !winPop.closed){ ");
sb.append(" winPop.focus(); }");
sb.append("else{ ");
sb.append("winPop = window.open(\"" + url + "\", \"winPop\"); } ");
ExtendedRenderKitService erks =
Service.getRenderKitService(FacesContext.getCurrentInstance(), ExtendedRenderKitService.class);
StringBuilder script = new StringBuilder();
script.append(sb.toString());
erks.addScript(FacesContext.getCurrentInstance(), script.toString());
As per this Sample ,on button click TaskFlow/URL will be launched in new window tab.
For invoking TaskFlow as URL following property need to be set on TaskFlow
Bean snippet to invoke TaskFlow programmatically using JavaScript on button click
Output
Button on page
Click on button ,TaskFlow opens in new window tab
No comments:
Post a Comment