2010-04-07 62 views
0

我有這樣的代碼:不能編輯我的H:數據表

<h:form> 
     <rich:dataTable value="#{my.lreqs}" var="req" 
      id="reqs" width="630px" > 
       <rich:column label="Value" styleClass="schColL" width="90px" 
       style="text-align:center"> 
       <f:facet name="header"> 
        <h:outputText value="#{my.colValue}" /> 
       </f:facet> 
       <h:inputText value="#{req.value}" > 
       </h:inputText> 
      </rich:column> 
     </rich:dataTable> 
     <h:commandButton value="Save" 
      action="#{my.saveChanges}" ></h:commandButton> 
    </h:form> 

,這是我的bean:

private List<Detail> lreqs; 


public void setLreqs(List<Detail> lreqs) { 
     this.lreqs = lreqs; 
} 

public void saveChanges() { 

     firstNewValue = lreqs.get(0).getValue(); 
     } 

/** 
    * @return the lreqs 
    */ 
    public List<Detail> getLreqs() { 
     if (currentJob != null && lreqs==null) { 
      lreqs = (List<Detail>) jobsBDataDAO.findByJobBooking(currentJob); 
     } 
     return lreqs; 
    } 

但是當我點擊保存 - 在req.value領域的新價值沒有被保存! 爲什麼呢?

+0

請修改您的問題以包含'saveChanges()'方法,該方法顯示您如何斷定新值未保存。 – BalusC 2010-04-07 11:46:05

+0

你有具體的class中的setValue()方法嗎? – Inv3r53 2010-04-08 10:11:12

+0

是的,我有setValue() – Dejell 2010-04-08 12:23:12

回答

0

我添加了一個錯誤。

a4j:richfaces的keepAlive標記在f:view .. 之前,並且未正確讀取。