p:commandLink fails to open page in new window/tab

后端 未结 7 1464
伪装坚强ぢ
伪装坚强ぢ 2020-12-17 09:42

I\'m trying to create a link to open a new page in a different window/tab and display some msg from backing bean but fail to do it, wonder know why?

here is my xhtml

7条回答
  •  囚心锁ツ
    2020-12-17 10:17

    Try this in your controller code, it worked for me perfectly.

    HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
                HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
                String uri = req.getRequestURI();
                res.getWriter().println("");
                FacesContext.getCurrentInstance().responseComplete();   
    

提交回复
热议问题