jsf 2 - JSF 2 template partial update -


i have following jsf 2 template page primefaces menu, want partially update cenral centent of page onclick of links left menu, don't want update entire page.i have gone throu posts in stackoverflow, suggetign should have form name in central_body_div, don't want sepcify form in central_body_div, dynamically loaded page have form it's own name, should able submit form in page appearing dynamically in central_body_div div.

first of layout page not loading , giving below exception.

cannot find component identifier "central_body_div" referenced "leftmenuformid:menuitem1".

experts can give solution problem. apprecite replies.

<?xml version='1.0' encoding='utf-8' ?>  <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <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">      <f:view contenttype="text/html">          <h:head>             <meta http-equiv="content-type" content="text/html; charset=utf-8" />             <h:outputstylesheet name="csslayout.css" library="css" />             <h:outputstylesheet name="default.css" library="css" />                     <title> lightweight mediation - secure pages </title>         </h:head>          <h:body id="securebody">              <div id="top">                 <ui:insert name="top">                     <ui:include src="/secure/home/header.xhtml" />                 </ui:insert>             </div>             <div id="content_holder">                 <div id="left">                     <ui:insert name="left">                         <ui:include src="/secure/home/leftmenu.xhtml" />                     </ui:insert>                 </div>                 <div id="central_body_div" class="left_content">                     <ui:insert name="content">content</ui:insert>                 </div>             </div>             <div id="bottom">                 <ui:insert name="bottom">                     <ui:include src="/secure/home/footer.xhtml" />                 </ui:insert>             </div>          </h:body>     </f:view> </html> 

my leftmenu.xhtml content below

<?xml version='1.0' encoding='utf-8' ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <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:p="http://primefaces.org/ui"       xmlns:f="http://java.sun.com/jsf/core">      <h:head>         <title>facelet title</title>     </h:head>     <h:body>         <ui:composition id="leftmenucompositionid">              <h:form id="leftmenuformid">                 <p:menu id="lmenuid">                     <p:menuitem id="menuitem1" value="page1" action="page1" update="central_body_div" partialsubmit="true"/>                     <p:menuitem id="menuitem2" value="page2"  action="page2" update="central_body_div" partialsubmit="true" />                 </p:menu>             </h:form>         </ui:composition>     </h:body> </html> 

change code following , try again,

leftmenu.xhtml

<?xml version='1.0' encoding='utf-8' ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">      <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:p="http://primefaces.org/ui"   xmlns:f="http://java.sun.com/jsf/core">  <h:head>     <title>facelet title</title> </h:head> <h:body>     <ui:composition id="leftmenucompositionid">          <h:form id="leftmenuformid">             <p:menu id="lmenuid">                 <p:menuitem id="menuitem1" value="page1" action="page1" update=":form1:central_body_div" partialsubmit="true"/>                 <p:menuitem id="menuitem2" value="page2"  action="page2" update=":form1:central_body_div" partialsubmit="true" />             </p:menu>         </h:form>     </ui:composition> </h:body> 

and template xhtml with,

<?xml version='1.0' encoding='utf-8' ?>   <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">   <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">  <f:view contenttype="text/html">      <h:head>         <meta http-equiv="content-type" content="text/html; charset=utf-8" />         <h:outputstylesheet name="csslayout.css" library="css" />         <h:outputstylesheet name="default.css" library="css" />                 <title> lightweight mediation - secure pages </title>     </h:head>      <h:body id="securebody">          <div id="top">          </div>         <div id="content_holder">             <div id="left">                 <ui:insert name="left">                     <ui:include src="leftmenu.xhtml" />                                         </ui:insert>             </div>             <h:form id="form1" >                 <h:panelgroup id="central_body_div">                     <script type="text/javascript">alert('content updated')</script>                     <ui:insert name="content">content</ui:insert>                 </h:panelgroup>             </h:form>         </div>         <div id="bottom">          </div>      </h:body> </f:view> 

it's checked , working.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -