JSF ActionListener不会触发

时间:2014-03-05 15:32:45

标签: jsf primefaces

调用函数vcardController.renderModify的动作侦听器不会触发(在函数renderModify中我将变量renderHiddenEdit设置为true)并且editCardForm中的面板不会渲染。有人可以帮帮我吗?

<h:form id="editCardForm">
                <p:panel id="editCard"  style="">
                    <p:panel rendered="#{vcardController.renderHiddenEdit}" >
                        <h:inputHidden id="resourceid" value="#{vcardController.resourceId}" />
                        <h:inputHidden id="vcardraw" value="#{vcardController.vcardRaw}" />
                        <h:graphicImage alt="" style="width: 3em;" class="imagesearch" url="#{resource['img:user.svg']}"/>
                    </p:panel>
                </p:panel>
            </h:form>

            <h:form id="viewCardForm">
                <p:panel id="viewCard" style="">
                    <p:panel rendered="#{vcardController.renderHidden}" >
                        <h:inputHidden id="resourceid" value="#{vcardController.resourceId}" />
                        <h:inputHidden id="vcardraw" value="#{vcardController.vcardRaw}" />
                        <p:commandButton
                            id="testmodifica"
                            class="mod nocorner modifycard"
                            value="modify"
                            update=":editCardForm"
                            actionListener="#{vcardController.renderModify}" />
                    </p:panel>
                </p:panel>
            </h:form> 

            <h:form id="formReqEdit" class="formReqEdit" style="display: none;">
                <h:inputHidden id="vcardraw" value="#{vcardController.vcardRaw}" />
                <h:inputHidden id="resourceid" value="#{vcardController.resourceId}" />
                <p:commandButton
                    id="requestForm"
                    style="display: none;"
                    update=":viewCardForm"
                    oncomplete="contactsDOMAction.showCard(xhr, status, args)"
                    actionListener="#{vcardController.activateModifyCard}" />   
            </h:form> 

1 个答案:

答案 0 :(得分:1)

  1. 如果要渲染“editCardForm”,则必须在命令按钮的更新参数中添加“editCardForm”
  2. 好的做法是添加“过程”。然后你确定将组件中的哪些数据发送到bean,如果你只想要调用动作监听器,则在你的case process =“@ this”中。

  3. RafaHernández说得对,如果有显示器你想要按下按钮:无?