JSF渲染h:commandLink ajax无法正常工作

时间:2016-04-14 19:46:53

标签: ajax jsf jsf-2.2

我构建了一个充当插入和编辑的简单页面:

<f:metadata>
    <f:viewParam name="id" value="#{bean.id}"  />
    <f:viewAction action="#{bean.init}" />
</f:metadata>
...............
<h:form>
    ...........
    <h:commandLink action="#{bean.update}" rendered="#{not empty bean.id}">
        <f:ajax execute="@form" render="@form" />
        Update <i class="fa fa-check"></i>
    </h:commandLink>
    <h:commandLink action="#{bean.save}" rendered="#{empty bean.id}">
       <f:ajax execute="@form" render="@form" />
       Save <i class="fa fa-check"></i>
    </h:commandLink>
</h:form>

因此页面检查它是否在网址中获得id参数,因此,创建&#34;更新&#34;链接,否则&#34;保存&#34;链接。

渲染的属性工作正常,但更新链接没有发送ajax请求,但保存链接正常。

当我删除rendered属性时,两者都可以正常工作!那么,如果rendered属性存在,更新链接无法正常工作?

0 个答案:

没有答案