2012-03-20 24 views
1

この問題が発生しました。私はh:formの中に2つのテーブルをラップします。また、異なるh:formタグでネストした表をラップしようとしました。だから私の目標は、ユーザーがチェックボックスをクリックするとサーバー側で解雇されるリスナーです。私はすべての入力を送信したくないので、execute = "@ this"を使用します.1つの属性のjavascriptイベントは起動されますが、サーバーのリスナーは決して使用しません。チェックボックスをクリックすると、要求がサーバーに送信されるのがわかります。それがなぜ呼び出されないのか分かりません。f:Ajaxリスナーは起動しません。予期しない動作

VIEW:

<h:form> 
       <table id="trades"> 
        <th class="image_cell"></th> 
        <th>Type</th> 
        <th>Portfolio</th> 
         <ui:repeat var="trade" value="#{controller.errorTrades}"> 
          <tr class="trade error"> 
           <td class="image_cell error"><h:graphicImage styleClass="expandable" url="resources/images/plus.png"></h:graphicImage></td> 
           <td id="type" class="error">#{trade.type}</td> 
           <td class="error">#{trade.portfolio}</td> 
          </tr> 
          <tr class="operations"> 
           <td id="#{trade.murexId}" class="operation_row" colspan="4"> 
             <table id="operations"> 
              <tr class="header"> 
               <th class="empty_cell"></th> 
               <th class="operation_cell">Operation</th> 
               <th>Time Transaction</th> 
               <th>Comment</th> 
               <th id="delete">Delete</th> 
              </tr> 
              <ui:repeat var="operation" value="#{trade.operationsSortList}"> 
               <tr class="operation"> 
                <th class="empty_cell"></th> 
                <td id="operation" class="operation_cell color">#{operation.operation}</td> 
                <td class="color">#{operation.time}</td> 
                <td class="color">#{operation.coment}</td> 
                <td class="color checkbox"> 
                 <h:selectBooleanCheckbox title="delete"> 
                  <f:ajax execute="@this" event="click" listener="#{controller.onDelete}" onevent="onDeleteProcess" /> 
                  <f:attribute name="murexId" value="#{trade.murexId}" /> 
                  <f:attribute name="operationId" value="#{operation.id}" /> 
                 </h:selectBooleanCheckbox>            
                </td> 
               </tr> 
              </ui:repeat> 
             </table> 
           </td> 
          </tr> 
         </ui:repeat> 
       </table> 
      </h:form> 

はCONTROLLER:

@ViewScoped 
public class Controller 
{ 
    private ArrayList trades; 
    private ArrayList errorTrades = new ArrayList(); 

    .......code 

    public boolean onDelete(AjaxBehaviorEvent event) 
    { 
     long murexId = 0; 
     BigDecimal operationId = null; 
     boolean result = false; 
     Trade trade; 
     Iterator itop; 
     Operation operation; 
     ......code 

     return true; 
    } 
} 

誰かが私を助けることができれば、私はそれを本当に感謝します。

おかげ

+2

ajaxリスナーメソッドは 'void'を返す必要があります。多分それが問題です。 –

+2

使用しているJSF impl/versionは何ですか?初期のMojarraのバージョンには、ネストされた ''にいくつかの特有の問題があります。代わりに ''を使用して、それらを除外してください。 – BalusC

+0

ブール値を返すとうまくいくと思いますが、voidを使っても動作しません。私はJSF 2.1を使用しています。私は多くのCSSを使用しており、で実装する方が簡単です。何か案が? – bribon

答えて

1

はほとんど私が働いてそれを得た

を解決しました。私は2番目のui:h:formを繰り返し、Iはを使用します。 execute = "@ this"の代わりにexecute = "@ form"を使用します。それが私が「ほぼ解決」した理由です...これがどうして起こるのか?

<h:form> 
     <ui:repeat var="operation" value="#{trade.operationsSortList}"> 
       <tr class="operation"> 
        <th class="empty_cell"></th> 
        <td id="operation" class="operation_cell color">#{operation.operation}</td> 
        <td class="color">#{operation.time}</td> 
        <td class="color">#{operation.coment}</td> 
        <td class="color checkbox"> 
         <h:selectBooleanCheckbox title="delete"> 
          <f:ajax execute="@this" event="click" listener="#{controller.onDelete}" onevent="onDeleteProcess" /> 
          <f:attribute name="murexId" value="#{trade.murexId}" /> 
          <f:attribute name="operationId" value="#{operation.id}" /> 
         </h:selectBooleanCheckbox>            
        </td> 
      </tr> 
    </ui:repeat> 
</h:form> 

ご協力いただきありがとうございます。

関連する問題