0

I'm having a issue with PrimeFaces 3.4 and Facelets I created a Facelets template with the following:

<?xml version='1.0' encoding='UTF-8' ?> 

<h:head>
    <h:outputStylesheet library="css" name="styles.css"></h:outputStylesheet>
</h:head>

<h:body>
    <p:layout fullPage="true">
        <p:layoutUnit position="north" size="200px" collapsible="true">
            <ui:include src="header.xhtml"></ui:include>
        </p:layoutUnit>
        <p:layoutUnit position="south" size="50px" collapsible="true">
            Sul
        </p:layoutUnit>
        <p:layoutUnit id="contentView" position="center">
            <ui:insert name="content"></ui:insert>
        </p:layoutUnit>        
    </p:layout>
</h:body>

My index.xhtml:

    <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition template="./maintemplate.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:define id="contentView" name="content">
        <ui:include src="#{userController.currentPage}"></ui:include>
    </ui:define>
</ui:composition>

So, the userController.currentPage contains at the beginning a login page that works with primeFaces componends. When I click the menu that is available inside the header.xhtml I have the following:

<p:menuitem value="Tickets" actionListener="#{userController.setCurrentPage('tickets.xhtml')}" update=":contentView" ajax="false"></p:menuitem>

After clicking the center layout gets blank. I don't see any error or information that something is wrong. I can render the page tickets.xhtml without any problem.

Any help is most appreciated.

I'm using Netbeans 7.3 RC1 - Apache Tomcat 7.0.34.0 / PrimaFaces 3.4 / JSF 2.1

EDIT: putting ajax="false" in the menu works, but it refreshed all page. Anyidea how I can make this work without having to refresh the full page, I would like to refresh just the center one.

Alexandre Alves
  • 411
  • 2
  • 10
  • 20

1 Answers1

0

finally managed to do it. Found over here the following:

How to ajax-refresh dynamic include content by navigation menu? (JSF SPA)

based on the above answer I performed the following operations: 1.put the ajax tag and the menu inside it. 2. And this was also my mistake, change the ajax render from the <ui:layoutUnit> to <h:form> 3. removed all the h:form tags from the child xhtml as it is now included in the template file.

After this it works withoout any problem.

Community
  • 1
  • 1
Alexandre Alves
  • 411
  • 2
  • 10
  • 20