我正在开发动态页面。想要使用tabmenu将xhtml页面包含到主xhtml页面中。当我运行代码总是相同的页面包括主页。标签不工作anoymore。
主要HTML。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
<title>İstatistik</title>
</f:facet>
</h:head>
<body>
<p:layout fullPage="true">
<p:layoutUnit position="north" style="font-size: 12px!important" >
<p:tabMenu id="tabmenu1" activeIndex="#{turnPage.index}" >
<p:menuitem value="Genel" outcome="main" actionListener="#{turnPage.actionEventPage(e, 0)}" update="mainpanel" />
<p:menuitem value="Demografik Göstergeler" outcome="main" actionListener="#{turnPage.actionEventPage(e, 1)}" update="mainpanel" />
<p:menuitem value="Mortalite ve Mobidite" outcome="main" actionListener="#{turnPage.actionEventPage(e, 2)}" update="mainpanel" />
<p:menuitem value="Risk Faktörleri" outcome="main" actionListener="#{turnPage.actionEventPage(e, 3)}" update="mainpanel" />
<p:menuitem value="Bağışıklama Anne/çocuk" outcome="main" actionListener="#{turnPage.actionEventPage(e, 4)}" update="mainpanel" />
<p:menuitem value="Sağlık Kurumları" outcome="main" actionListener="#{turnPage.actionEventPage(e, 5)}" update="mainpanel" />
</p:tabMenu>
</p:layoutUnit>
<p:layoutUnit position="center">
<p:outputPanel id="mainpanel" >
<h:form>
<ui:include src="#{turnPage.pathpage}"/>
</h:form>
</p:outputPanel>
</p:layoutUnit>
</p:layout>
</body>
}
这是我的豆。
{
private int index;
private String pathpage;
public void setPathpage(String pathpage) {
this.pathpage = pathpage;
}
public String getPathpage() {
return pathpage;
}
public void setIndex(int index) {
this.index = index;
}
public int getIndex() {
return index;
}
public void actionEventPage(ActionEvent e, int index){
switch (index) {
case 0:
pathpage = "forms/genel.xhtml";
break;
case 1:
pathpage = "forms/demografi.xhtml";
break;
case 2:
pathpage = "forms/mortalite.xhtml";
break;
case 3:
pathpage = "forms/riskfaktor.xhtml";
break;
case 4:
pathpage = "forms/bagisiklama.xhtml";
break;
case 5:
pathpage = "forms/saglikkurum.xhtml";
break;
答案 0 :(得分:0)
我认为你应该从actionEventPage方法中删除ActionEvent参数。 在xhtml:
#{turnPage.actionEventPage(5)}
在豆上:
public void actionEventPage(int index)...