Question

I´ve a page where I load my content:

  <?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:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      >
    <h:head>
        <meta charset="UTF-8"/>
        <title>Dashboard</title>
        <link rel="stylesheet" type="text/css" href="../css/graficas1_estilos.css" media="all" />           
    </h:head>
    <h:body>
        <div id="page">
            <div id="header">
                <ui:insert name="header" >
                    <ui:include src="Header.xhtml" />
                </ui:insert>
            </div>
            <div id="left">
                <ui:insert name="left" >
                    <ui:include src="Left.xhtml" />
                </ui:insert>
            </div>
            <div id="content">
                <ui:insert name="content" >
                     <iframe scrolling="auto" height="100%" frameborder="0" width="100%" 
                     src="Content.xhtml" name="iFrameMain" id="iFrameMain" pane="center">    
                     </iframe>
                </ui:insert>
            </div>
            <div id="footer">
                <ui:insert name="footer" >
                    <ui:include src="Footer.xhtml" />
                </ui:insert>
            </div>
        </div>
    </h:body>
</html>

and on my Left.xhtml I´ve my dynamic menu:

<ui:composition>
             <h:form id="dash2">  
         <div class="menu_izquierda">
                         <p:panelMenu id="menuDinamico" model="#{usuariosMB.model}" style="width:200px" styleClass="leftMenu" />
                       </div>
             </h:form>      
    </ui:composition>

Finally to build my menu in my managed bean I add:

MenuModel model = new DefaultMenuModel();
DefaultSubMenu inicioMenu = new DefaultSubMenu(Constantes.Inicio);
model.addElement(inicioMenu);
DefaultMenuItem itemD = new DefaultMenuItem(Constantes.Dashboard);
itemD.setOutcome(Constantes.outcome);
inicioMenu.addElement(itemD);

So when I click on a link it reloads the entire page. What should I do in so only the iframe get´s reloaded after clicking on a menu link??? Thanks in advance.

No correct solution

OTHER TIPS

If you can use javascript,

function reloadIframe(e) {
  e.preventDefault();
  document.getElementById('iFrameMain').contentDocument.location.reload(true);
}

And, in the link that causes you the problem,

<button onclick="reloadIframe(event)">Click me</button>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top