To Display a page or servlet output in a popup window

Suppose that the page name is view.jsp
    
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;  

   FacesContext context = FacesContext.getCurrentInstance();
            HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
            String targetURL = request.getRequestURL().toString();
            targetURL = targetURL.substring(0, targetURL.lastIndexOf("/") + 1) + "view.jsp";
            System.out.println(targetURL);
            ExtendedRenderKitService service = Service.getRenderKitService(context, ExtendedRenderKitService.class);
            String script = "window.open('" + targetURL + "', '', 'location=0, status=0, resizable=1, scrollbars=0');";
            service.addScript(FacesContext.getCurrentInstance(), script);

Comments

Popular posts from this blog

Another user has changed the row with primary key oracle.jbo.Key[12 ].

weblogic windows JPS-01050: Opening of wallet based credential store failed. Reason java.io.IOException: Failed to lock cwallet.sso.lck

Working With File Throgh WebUtill