I have a form in the <ui:insert name="content" /> When I save the data with a p:commandButton I can update the form and things within the <ui:insert name="content" />. But I am having trouble figuring out how to update components in the <ui:include src="/sections/menus/topMenu.xhtml"/>
Inside the topmenu I have a subview for a panel with links that get rendered depending on whether a person is logged in or not. when they are logged in I show their username. If I update the user name in the content part of the template, I want to update the ui so that the name in the menu also updates without a page refresh. But that is a fallback I can use too. Refresh the page after update. But would rather not. I'll post more code if you want but trying to keep it to a minimum to start.
<h:body>
<div id="wrap">
<div title="Container">
<ui:include src="/sections/base/header.xhtml"/>
</div><!-- End of Banner -->
<div id="baseTemplateTopMenu" title="Menu">
<ui:include src="/sections/menus/topMenu.xhtml"/>
</div><!-- End of Menu -->
<div id="sbt_contentbody">
<div title="Left Column">
<ui:include src="/sections/base/leftsidebar.xhtml"/>
</div> <!-- End of Left Column -->
<div title="Content Column">
<ui:insert name="content" />
</div><!-- End of Centre Column -->
<div title="Right Column">
<ui:include src="/sections/base/rightsidebar.xhtml"/>
</div><!-- End of Right Column -->
</div>
<div id="footer" title="Footer" class ="container">
<ui:include src="/sections/base/footer.xhtml"/>
</div><!-- End of Footer -->
</div><!-- End of Container -->
</h:body>
Below is the p:commandButton that saves the user info
<p:commandButton id="id_SubmitUserInfoPrefs"
value="Update"
action="#{userPreferences.updateUserInfo()}" styleClass="bottom_margin_2em top_margin_2em">
<f:ajax execute="@form" render="@form :topMenuLoginView:topMenuLoginForm" />
<!-- tried adding 'update=":"topMenuLoginView:topMenuLoginForm"' as well. -->
Below is in the menu part of the template.
<f:subview id="topMenuLoginView">
<h:form id="topMenuLoginForm" prependId="false">
<ul>
<h:panelGroup id="loginPanel" rendered="#{!user.loggedIn}">
<li><h:outputLink value="javascript:void(0)" onclick="topMenuLoginDialog.show()"
title="login" styleClass="loginpanelclass">Log In</h:outputLink></li>
<li><h:link value="Register" outcome="/registration/register.xhtml" /></li>
</h:panelGroup>
<h:panelGroup id="logoutPanel" rendered="#{user.loggedIn}">
<li><h:link value="#{user.nickname}" outcome="#{navigationprops.userprefs}" /> </li>
<li><p:commandLink action="#{webAuthenticationBean.logout}"
update=":topMenuLoginView:topMenuLoginForm">
Logout
</p:commandLink>
</li>
</h:panelGroup>
</ul>
</h:form>
</f:subview>
render="@form :topMenuLoginForm"
and just remove the<f:subview id="topMenuLoginView">
from that page? – Cohesive