我希望你能帮助我。我使用jsf和richefaces,我有一个jsf页面,我想根据参数包含所有其他页面,我的问题是如何在我的xhtml文件中引入测试条件。
感谢您的回复,有我的代码,但它不起作用,我的 bean
public class TestBean {
private boolean ajoutH;
private boolean listH;
public boolean isListH() {
FacesContext fc = FacesContext.getCurrentInstance();
Map<String,String> params =
fc.getExternalContext().getRequestParameterMap();
String id = params.get("listH");
if(id.equals("listH")){
return true;}
else{
return false;
}
}
public boolean isAjoutH() {
FacesContext fc = FacesContext.getCurrentInstance();
Map<String,String> params =
fc.getExternalContext().getRequestParameterMap();
String id = params.get("ajoutH");
if(id.equals("ajoutH")){
return true;}
else{
return false;}
还有我的页面 jsf
<rich:panelMenuGroup label="Hotes">
<rich:panelMenuItem>
<h:outputText value="Ajouter Hote" event="onclick">
<f:param value="{ajoutH}" name="ajoutH" />
</h:outputText>
</rich:panelMenuItem>
<rich:panelMenuItem >
<h:outputText value="Gérer Hotes" >
<f:param value="{listH}" name="listH" />
</h:outputText>
......
<h:panelGroup rendered="#{TestBean.ajoutH}">
<ui:include src="./ajoutHote.xhtml"/>
</h:panelGroup>
<h:panelGroup rendered="#{TestBean.listH}">
<ui:include src="./listHotes.xhtml"/>
</h:panelGroup>