0
从来就一个页面,我打开我的内容:如何使用primefaces动态菜单加载iframe上的内容?
<?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>
和我Left.xhtml从来就我的动态菜单:
<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>
最后建立我的菜单我的托管bean我加:
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);
所以,当我点击一个链接它重新加载整个页面。 我应该怎么做,只有iframe在点击菜单链接后重新加载? 在此先感谢。
我尝试你的建议,但不幸的是I'm获得:遗漏的类型错误:无法读取property'contentDocument'为null – linker85
你有'iFrameMain'定义了吗? – rpax
是的,我确定了它 – linker85