Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect in managed bean not working
    primarykey
    data
    text
    <p>I'm having trouble with a JSF test application and PrimeFaces components, and can't find the error.</p> <p>I started out with a template file (layoutTempl.xhtml) defined by:</p> <pre><code>.... &lt;h:body&gt; &lt;p:layout fullPage="true" &gt; &lt;p:layoutUnit position="north" size="95" &gt; &lt;ui:insert name="menubar" &gt; MenuBar &lt;/ui:insert&gt; &lt;/p:layoutUnit&gt; &lt;p:layoutUnit position="west" resizable="false" size="250"&gt; &lt;ui:insert name="tree" &gt; ProjectTree &lt;/ui:insert&gt; &lt;/p:layoutUnit&gt; &lt;p:layoutUnit position="center"&gt; &lt;ui:insert name="main" &gt; MainContent &lt;/ui:insert&gt; &lt;/p:layoutUnit&gt; &lt;p:layoutUnit position="south" size="45"&gt; &lt;ui:insert name="footer" &gt; Footer &lt;/ui:insert&gt; &lt;/p:layoutUnit&gt; &lt;/p:layout&gt; &lt;/h:body&gt; .... </code></pre> <p>This template is used in two pages (indexContent.xhtml):</p> <pre><code>.... &lt;body&gt; &lt;ui:composition template="./layoutTempl.xhtml"&gt; &lt;ui:define name="menubar"&gt; MenuBar &lt;/ui:define&gt; &lt;ui:define name="tree"&gt; Project Tree &lt;/ui:define&gt; &lt;ui:define name="main"&gt; &lt;ui:include src="index.xhtml"/&gt; &lt;/ui:define&gt; &lt;ui:define name="footer"&gt; Footer &lt;/ui:define&gt; &lt;/ui:composition&gt; &lt;/body&gt; .... </code></pre> <p>and (abcContent.xhtml):</p> <pre><code>.... &lt;body&gt; &lt;ui:composition template="./layoutTempl.xhtml"&gt; &lt;ui:define name="menubar"&gt; MenuBar &lt;/ui:define&gt; &lt;ui:define name="tree"&gt; Project Tree &lt;/ui:define&gt; &lt;ui:define name="main"&gt; &lt;ui:include src="abc.xhtml"/&gt; &lt;/ui:define&gt; &lt;ui:define name="footer"&gt; Footer &lt;/ui:define&gt; &lt;/ui:composition&gt; &lt;/body&gt; .... </code></pre> <p>The included files index.xhtml contain:</p> <pre><code>.... &lt;h:body&gt; &lt;ui:composition &gt; Hello from BareTest &lt;br /&gt;&lt;br /&gt; &lt;h:form id="myform"&gt; &lt;p:selectOneMenu id="scroll2" value="#{listTestBean.selectedMyObject}" &gt; &lt;f:selectItems value="#{listTestBean.myObjects}"/&gt; &lt;p:ajax event="change" listener="#{listTestBean.valueChanged}"/&gt; &lt;/p:selectOneMenu&gt; &lt;br/&gt;&lt;br/&gt; &lt;/h:form&gt; &lt;/ui:composition&gt; &lt;/h:body&gt; .... </code></pre> <p>while abc.xhtml contains:</p> <pre><code>.... &lt;h:body&gt; &lt;h2&gt;We got at abc page!&lt;/h2&gt; &lt;br /&gt;&lt;br /&gt; &lt;h:form id="abcForm"&gt; &lt;p&gt;#{listTestBean.selectedMyObject}&lt;/p&gt; &lt;p:commandLink id="Ajax" ajax="true" action="indexContent?faces-redirect=false"&gt; &lt;h:outputText value="Main page (link)" /&gt; &lt;/p:commandLink&gt; &lt;/h:form&gt; &lt;/h:body&gt; .... </code></pre> <p>The request scoped managed bean listTestBean contains getter and setter methods and the valueChanged method. The valueChanged method holds:</p> <pre><code>.... try { FacesContext.getCurrentInstance().getExternalContext().redirect("abcContent.xhtml"); } catch (IOException ioe) { System.err.println("listTestBean.valueChanged: IOException"); } .... </code></pre> <p>which is basically a redirect to the abcContent page.</p> <p>However, when I select an item from the selectItem component the abcContent.xhtml page is not rendered, with the specified layoutTempl?</p> <p>That I don't understand at all, sorry! It's probably something trivial but I can't solve it!</p> <p>Regards</p>
    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