Note that there are some explanatory texts on larger screens.

plurals
  1. POp:commandLink fails to open page in new window/tab
    primarykey
    data
    text
    <p>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?</p> <p>here is my xhtml file:</p> <pre><code>&lt;html:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets"&gt; &lt;h:body&gt; &lt;h:form id="form66"&gt; &lt;p:commandLink actionListener="#{testing.getMessage}" action="msg.xhtml" target="_blank"&gt;get Msg&lt;/p:commandLink&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre> <p>here is my Msg.xhtml page</p> <pre><code>&lt;HTML xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets"&gt; &lt;h:head&gt; &lt;title&gt;testing&lt;/title&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;div class="div"&gt; &lt;p:panel&gt; &lt;f:facet name="header"&gt; testing &lt;/f:facet&gt; &lt;div class="paddingForPanel"&gt; &lt;h:outputText value="#{testing.msg}" escape="false"/&gt; &lt;/div&gt; &lt;/p:panel&gt; &lt;/div&gt; &lt;/h:body&gt; &lt;/HTML&gt; </code></pre> <p>here is my testing.java</p> <pre><code>public void getMessage() { this.msg = "haha"; } private String msg; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } </code></pre> <p><br /> the code above fail to open a new tab/window, I try to do like below, it success to open the new page in new tab but the msg is empty, when I debug, it got success call the listenner getMessage, I wonder know why the msg is empty in the msg.xhtml page? Thanks in advance....</p> <pre><code>&lt;p:commandLink actionListener="#{testing.getMessage}" oncomplete="window.open('msg.xhtml')"&gt;broadcast Msg&lt;/p:commandLink&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload