Java 动态加载的命令链接不工作

Java 动态加载的命令链接不工作,java,jsf,Java,Jsf,我正在尝试使用动态加载视图。 那部分工作没有问题。但是,在该视图中使用commandLinks并不能解决这个问题 动态加载目标视图的容器: <h:form> <h:commandLink> <f:param name="tmp2" value="tmp/newxhtml.xhtml"/> <f:ajax render=":newXhtml"/> </h:commandLink> </

我正在尝试使用
动态加载视图。 那部分工作没有问题。但是,在该视图中使用commandLinks并不能解决这个问题

动态加载目标视图的容器:

<h:form>
    <h:commandLink>
        <f:param name="tmp2" value="tmp/newxhtml.xhtml"/>
        <f:ajax render=":newXhtml"/>
    </h:commandLink>
</h:form>

<h:panelGroup layout="block" id="newXhtml">
    <ui:include src="#{param['tmp2']}"/>
</h:panelGroup>

当我不使用
包含页面,而是使用带有action属性的普通
来将包含页面保存到
@SessionScope
bean中时,我让它工作了

其中包括xhtml:

 <h:form>
    <f:ajax render=":newXhtml">
        <h:commandLink action="#{includeBean.setIncludePage('tmp/newXhtml.xhtml')}">
        </h:commandLink>
    </f:ajax>
 </h:form>


 <h:panelGroup layout="block" id="newXhtml">
    <ui:include src="#{includeBean.includePage}"/>
 </h:panelGroup>
这可能有用
public class BackingBean{

    public void sampleMethod() {
         //breakpoint here is never hit
    }

}
 <h:form>
    <f:ajax render=":newXhtml">
        <h:commandLink action="#{includeBean.setIncludePage('tmp/newXhtml.xhtml')}">
        </h:commandLink>
    </f:ajax>
 </h:form>


 <h:panelGroup layout="block" id="newXhtml">
    <ui:include src="#{includeBean.includePage}"/>
 </h:panelGroup>
@Named
@SessionScope
public class IncludeBean implements Serializable {

  private static final long serialVersionUID = 1L;

  private String includePage;

  @PostConstruct
  public void init() {
    includePage = "tmp/newxhtml.xhtml";
  }

  public String getIncludePage() {
    return includePage;
  }

  public void setIncludePage(String includePage) {
    this.includePage = includePage;
  }

}