0

enter image description here

I have this situation : -Eclipse Mars -Primefaces 6.2 -JSF 2.1 -ibm portal framework -running on websphere

When I click on the primefaces menuitem to open a new xhtml, I need this new xhtml be opened at the same webpage without loose all the another html existin components. I need just a refresh.

here it is my project :

My main page (xhtml) :

<h:body>
        <div id="divMain" style="height:200px">
            <ui:insert name="cabecalho">
                <ui:include src="/_MF/jsf/MainMenu.xhtml"></ui:include>
            </ui:insert>

            <ui:insert name="conteudo">


            </ui:insert>        
        </div>       
    </h:body>

MainMenu.xhtml :

<h:form id="myFormMainMenu">
            <div id="mainMenu">

                <p:megaMenu orientation="#{megaMenuView.orientation}" style="margin-top:20px" autoDisplay="true">
                <p:submenu label="DI" icon="ui-icon-check">
                    <p:column>
                        <p:submenu label="OPTIONS">
                            <p:menuitem value="Listing" icon="ui-icon-document"
                                ajax="false" action="#{mainMenuMB.listar()}" />
                        </p:submenu>
                    </p:column>
                </p:submenu>
            </p:megaMenu>

            </div>
</h:form>

Another form raised from menuitem listar() :

<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"
    xmlns:p="http://primefaces.org/ui">

 <ui:composition template="/_MF/jsf/MainPage.xhtml">
    <ui:define name="conteudo">
        <div id="divListar">
          <h1>User settings.....</h1>
        </div>
    </ui:define>
  </ui:composition>


</html>
Al2x
  • 1,001
  • 5
  • 26
  • 37
  • @Kukeltje this topic you sent me works fine with commandLink but it does not work with – Al2x Jun 26 '18 at 18:52
  • When I click on menuitem it loads the new xhtml but it cleans all the existing html component – Al2x Jun 26 '18 at 18:59
  • `ajax="false"`does a full refresh... try with ajax in a correct way – Kukeltje Jun 26 '18 at 19:56
  • thanks @Kukeltje. it worked with the existing post you sent me and update on the menuitem tag. And removing ajax="false" – Al2x Jun 27 '18 at 12:09

1 Answers1

0

The solution for this issue was resolved with both items : the link and comments below : added update="content" and removed tag ajax="false"

it worked as expected with this link : How to ajax-refresh dynamic include content by navigation menu? (JSF SPA) <f:ajax render=":content"> ...

and

this one : I added update='content' and removed ajax="false"

 <p:menuitem value="Listing" icon="ui-icon-document" 
                                action="#{mainMenuMB.setPage('Listar')}" update="content"/>
Al2x
  • 1,001
  • 5
  • 26
  • 37