Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamicly included page form first submit fails
    primarykey
    data
    text
    <p>I got a strange behaviour on dynamicly included page</p> <p>My first page has a combo to choose from different pages to include :</p> <pre><code> &lt;h:panelGrid columns="2"&gt; &lt;h:outputLabel value="Choose your page to include" /&gt; &lt;h:selectOneMenu id="pageList" value="#{anyPageBean.page}"&gt; &lt;f:selectItems value="#{anyPageBean.pageList}" var="w" itemValue="#{w}" itemLabel="#{w}" /&gt; &lt;/h:selectOneMenu&gt; &lt;/h:panelGrid&gt; </code></pre> <p>The AnyPageBean just gives back one of the 2 following pages : pilotNoTemplate.xhtml or pipo.xhtml</p> <pre><code>@ManagedBean @SessionScoped public class AnyPageBean { private String page; private java.util.List&lt;String&gt; pageList; public AnyPageBean() { super(); pageList = new ArrayList&lt;String&gt;(); pageList.add("pilotNoTemplate.xhtml"); pageList.add("pipo.xhtml"); } </code></pre> <p>The pilotNoTemplate.xhtml appears correctly when i choose that page (the pipo page also).</p> <p>But when i submit the form from pilotNoTemplate.xhtml, JSF considers that submit as a POST which is OK, but only Phase1 and Phase 6 are spanned, WHY ? I have a PhaseListener showing the Phases, it prints :</p> <pre><code>INFO IN pour /jsf2-todo-001-dynamic-page-include-v2/any.faces ¤¤¤¤¤ POST INFO AJAX BEFORE RESTORE_VIEW 1 for viewId=null INFO AJAX AFTER RESTORE_VIEW 1 for viewId=/any.xhtml INFO AJAX BEFORE RENDER_RESPONSE 6 for viewId=/any.xhtml INFO AJAX AFTER RENDER_RESPONSE 6 for viewId=/any.xhtml </code></pre> <p>If anything was filled in the form, it gets resetted ...</p> <p>the SECOND submit is all right, all the phase are spanned :</p> <pre><code>INFO IN pour /jsf2-todo-001-dynamic-page-include-v2/any.faces ¤¤¤¤¤ POST INFO AJAX BEFORE RESTORE_VIEW 1 for viewId=null INFO AJAX AFTER RESTORE_VIEW 1 for viewId=/any.xhtml INFO AJAX BEFORE APPLY_REQUEST_VALUES 2 for viewId=/any.xhtml INFO AJAX AFTER APPLY_REQUEST_VALUES 2 for viewId=/any.xhtml INFO AJAX BEFORE PROCESS_VALIDATIONS 3 for viewId=/any.xhtml INFO AJAX AFTER PROCESS_VALIDATIONS 3 for viewId=/any.xhtml INFO AJAX BEFORE UPDATE_MODEL_VALUES 4 for viewId=/any.xhtml INFO AJAX AFTER UPDATE_MODEL_VALUES 4 for viewId=/any.xhtml INFO AJAX BEFORE INVOKE_APPLICATION 5 for viewId=/any.xhtml INFO AJAX AFTER INVOKE_APPLICATION 5 for viewId=/any.xhtml INFO AJAX BEFORE RENDER_RESPONSE 6 for viewId=/any.xhtml INFO AJAX AFTER RENDER_RESPONSE 6 for viewId=/any.xhtml </code></pre> <p>My template page :</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"&gt; &lt;h:head&gt; &lt;meta http-equiv="Cache-Control" content="no-store" /&gt; &lt;meta http-equiv="Pragma" content="no-cache" /&gt; &lt;meta http-equiv="Expires" content="0" /&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;div&gt; &lt;h:panelGroup id="globalMessages"&gt; &lt;h:messages globalOnly="false" styleClass="messages" /&gt; &lt;/h:panelGroup&gt; &lt;ui:insert name="content" /&gt; &lt;/div&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre> <p>the composition page, enabling to choose a page to include :</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" &gt; &lt;ui:composition template="/layout/template.xhtml"&gt; &lt;ui:define name="content"&gt; &lt;h:form id="chooseForm"&gt; &lt;h:panelGrid columns="2"&gt; &lt;h:outputLabel value="Choose your page to include" /&gt; &lt;h:selectOneMenu id="pageList" value="#{anyPageBean.page}"&gt; &lt;f:selectItems value="#{anyPageBean.pageList}" var="w" itemValue="#{w}" itemLabel="#{w}" /&gt; &lt;/h:selectOneMenu&gt; &lt;/h:panelGrid&gt; &lt;h:commandButton id="show" value="Show page"&gt; &lt;f:ajax event="click" execute="@form" render=":panelForDynaPage :globalMessages" /&gt; &lt;/h:commandButton&gt; &lt;/h:form&gt; &lt;h:panelGroup id="panelForDynaPage"&gt; &lt;ui:include id="includeContenu" src="#{anyPageBean.page}" /&gt; &lt;/h:panelGroup&gt; &lt;/ui:define&gt; &lt;/ui:composition&gt; &lt;/html&gt; </code></pre> <p>the pilotNoTemplate.xhtml page :</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"&gt; &lt;f:metadata&gt; &lt;f:viewParam id="b" name="id" value="#{pilotAction.id}" /&gt; &lt;/f:metadata&gt; &lt;f:event id="a" listener="#{pilotAction.prepare}" type="preRenderView" /&gt; &lt;h:form id="formPilot"&gt; &lt;h:panelGrid columns="2"&gt; &lt;h:outputLabel value="#{appMsg['pilot.firstname']}" /&gt; &lt;h:inputText id="firstname" label="#{appMsg['pilot.firstname']}" value="#{pilotHolder.pilot.firstname}" required="true" /&gt; &lt;h:outputLabel value="#{appMsg['pilot.lastname']}" /&gt; &lt;h:inputText id="lastname" label="#{appMsg['pilot.lastname']}" value="#{pilotHolder.pilot.lastname}" /&gt; &lt;h:outputLabel value="#{appMsg['pilot.age']}" /&gt; &lt;h:inputText id="age" label="#{appMsg['pilot.age']}" value="#{pilotHolder.pilot.age}" required="true" validator="#{pilotAction.validateAge}" /&gt; &lt;/h:panelGrid&gt; &lt;h:commandButton id="merge" action="#{pilotAction.doMerge}" value="#{pilotHolder.pilot.id ne null ? appMsg['pilot.update'] : appMsg['pilot.create']}"&gt; &lt;f:ajax id="ajaxm" event="click" execute="@form" render=":panelForDynaPage :globalMessages" /&gt; &lt;/h:commandButton&gt; &lt;/h:form&gt; &lt;/ui:composition&gt; </code></pre> <p>I paid attention to gives "id" to every component in the xhtml page, since there are that kind of problems without it, is seems to be unsuffient in my case. any idea ?</p> <p>I 've seen others having the same problem, did you find any solution ?</p>
    singulars
    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.
    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