Note that there are some explanatory texts on larger screens.

plurals
  1. POui:include with method breaks the jsf's ajax function
    primarykey
    data
    text
    <p>I'm facing a pretty similar issue on which I already made a ticket but now the problem arises in my main project. The previous ticket involved a test project. <a href="https://stackoverflow.com/questions/11650565/ajax-update-not-working-inside-uicomposition">Here's</a> the link to the ticket. I'll first explain my project briefly and then provide the code.</p> <p>It's a basic ui since I left out irrelevant parts, but when you start the webapp you should be directed to the main page which has an intro loaded through the use of ajax. I'm using a managedbean called Navigation which is a simple pojo with 2 annotations and one string property called 'page'. I've set the property to 'intro', so it's loaded by default.</p> <pre class="lang-java prettyprint-override"><code>// Navigation.java @ManagedBean @RequestScoped public class Navigation { private String page = "intro"; public String getPage() { return page; } public void setPage(String page) { this.page = page; } } </code></pre> <p>index.xhtml looks like this:</p> <pre class="lang-html prettyprint-override"><code>&lt;!-- index.xhtml --&gt; &lt;h:body&gt; &lt;!-- Navigation --&gt; &lt;h:form&gt; &lt;p:menubar&gt; &lt;p:menuitem value="Home" icon="ui-icon-home" action="#{navigation.setPage('intro')}" update=":contentPanel" /&gt; &lt;p:submenu label="Actions" icon="ui-icon-transferthick-e-w"&gt; &lt;p:submenu label="Employee"&gt; &lt;p:menuitem value="Search" action="#{navigation.setPage('employee/find')}" update=":contentPanel" /&gt; &lt;/p:submenu&gt; &lt;/p:submenu&gt; &lt;/p:menubar&gt; &lt;/h:form&gt; &lt;!-- ContentPanel --&gt; &lt;p:panel id="contentPanel" styleClass="content"&gt; &lt;ui:include src="/#{navigation.page}.xhtml" /&gt; &lt;/p:panel&gt; &lt;/h:body&gt; </code></pre> <p>Now, when you navigate to 'Actions/Employee/Create new' the file find.xhtml does get loaded into the main page but, the form itself doesn't work. Here's the file:</p> <pre class="lang-html prettyprint-override"><code>&lt;!-- find.xhtml --&gt; &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"&gt; &lt;f:facet name="header"&gt; Create new employee &lt;/f:facet&gt; &lt;h:outputLabel value="User ID: " for="userId" /&gt; &lt;p:inputText value="#{managedEmployee.userId}" id="userId" /&gt; &lt;p:commandButton value="Show" update="result" /&gt; &lt;h:outputText id="result" value="#{managedEmployee.userId}" /&gt; &lt;/ui:composition&gt; </code></pre> <p>So a user would be able to input a userId in the form and it would be displayed near the form when commandbutton is pressed. Obviously I must be doing something wrong but I can't seem to figure it out. I don't like saying it, but I'm desperate for an answer.</p> <p>Thanks in advance!</p>
    singulars
    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