JSF 2.2 - 使用<include>时未调用Backingbean方法

时间:2016-04-28 03:51:13

标签: jsf jsf-2 include managed-bean commandbutton

这是我第二次尝试(希望这次比以前更好),简要介绍我的结构:

我有两个index.xhtml的视图:

查看1:     Header.xhtml     DefaultPage.xhtml     Footer.xhtml

在我的Header.xhtml中,我有menubar,它使用不同的GET参数值来保存对index.xhtml的引用。根据我的GET参数值(content_page_to_render),我生成第二个视图,如下所示:

查看2:  Header.xhtml  Page2.xhtml  Footer.xhtml

以下是Index.xhtml和Page2.xhtml的示例代码:

Index.xhtml:

<insert id="header">
 <include src="header.xhtml">
</insert>

<insert id="content">
    <if test="${content_page_to_render == body1.xhtml}">
      <include src="body1.xhtml">
    </if>
    <if test="${content_page_to_render == body2.xhtml}">
      <include src="body2.xhtml">
    </if>
</insert>

我的body2.xhtml看起来像这样:     &LT; form id =“formId”class =“form-horizo​​ntal”role =“form”&gt;       &LT; commandButton action =“#{backingBean.method}”value =“Submit”/&gt;     &LT; /形式&GT;

未调用此辅助bean方法。但是,当我将这个commandButton移动到index.xhtml(即在包含的页面之外)时,它正在工作(即调用支持bean方法)。

P.S。 : 1.试图将动作值更改为垃圾并且它没有效果,上述行为不会改变,这意味着由于某种原因根本不考虑动作值。 2.我尝试创建一个示例JSF项目,其基本包含没有多个视图,并且工作正常。但是,在我的实际项目中,包含不起作用。

请求你帮助我。

谢谢&amp;问候, Ravikiran Mane。

0 个答案:

没有答案