2012-03-28 41 views
1

JSF代码:A4J:的commandButton行动不费一枪丰富:popupPanel RichFaces的4 JSF 2

<rich:popupPanel modal="true" id="editPanelUser"> 
    <h:form> 
    <h:panelGrid columns="2"> 
     <h:outputLabel value="first name (*)" /> 
     <h:inputText value="#{usersBean.currentItem.firstName}" /> 
    </h:panelGrid> 
    <h:panelGrid> 
     <a4j:commandButton value="save" 
     oncomplete="if(#{facesContext.maximumSeverity==null}) #{rich:component('editPanelUser')}.hide()" 
     action="#{usersBean.runAction('saveUser')}"/> 
    </h:panelGrid> 
    </h:form> 
</rich:popupPanel> 

支持bean代码:

public void setRunAction(String action){ 
    if("saveUser".equals(action)){ 
     ... 
    } 
} 

我把一个断点在setRunAction方法,但它从来没有使它在这里。想法?

有什么奇怪的是,A4J:打开这个弹出commandLink代码工作正常,并调用runAction方法:

<h:form> 
    <rich:dataTable value="#{usersBean.dataList}" var="singleUser" 
    rowClasses="row1,row2" rowKeyVar="row" id="singleUserTable" 
    ajaxKeys="#{usersBean.keys}"> 
    <rich:column> 
     <a4j:commandLink id="editlink" 
     oncomplete="#{rich:component('editPanelUser')}.show();return false;"> 
     <f:setPropertyActionListener value="editUser" 
      target="#{usersBean.runAction}" /> 
     </a4j:commandLink> 
    </rich:column> 
    </rich:dataTable> 
</h:form> 
+0

有没有的 Daniel 2012-03-28 12:15:57

+0

我在里放了一个 2012-03-28 12:30:30

+0

只是为了检查,尝试删除oncomplete ...也不应该是eq null而不是你的条件...还检查萤火虫 – Daniel 2012-03-28 12:35:59

回答

0

请认真Ë尝试下面的XHTML代码(也确保你没有其他形式的元素中表格):

<rich:popupPanel modal="true" id="editPanelUser"> 
    <h:form id="myForm"> 
    <h:panelGrid columns="2"> 
     <h:outputLabel value="first name (*)" /> 
     <h:inputText value="#{usersBean.currentItem.firstName}" /> 
    </h:panelGrid> 
    <h:panelGrid> 
     <a4j:commandButton id="myBtn" value="save" 
     oncomplete="if(#{facesContext.maximumSeverity==null}) #{rich:component('editPanelUser')}.hide()" 
     actionListener="#{usersBean.runAction('saveUser')}"/> 
    </h:panelGrid> 
    </h:form> 
</rich:popupPanel> 

和方法管理的bean:

public void runAction(String action){ 
    if("saveUser".equals(action)){ 
     ... 
    } 
} 
0

改变你的行动属性如下

action="#{usersBean.setRunAction('saveUser')}" 

或更改方法如

public void runAction(String action){} 
相关问题