2011-08-19 50 views
1

我對Apache Trinidad tr:panelTabbed組件有問題。我試圖將不同的表單放入此組件的選項卡(tr:showDetailItem)中。這對於第一次嘗試,並沒有在所有的工作(我在的NullPointerException得到,org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.FormValueRenderer.addNeededValue(FormValueRenderer.java:126):Apache Trinidad tr:panelTabbed總是驗證當前選項卡的內容

<tr:panelTabbed> 
    <tr:showDetailItem text="First tab"> 
    <tr:form> 
     <tr:inputText label="Value 1" value="#{myBean.someValue1}" required="true" /> 
     <tr:commandButton text="Save Value 1" actionListener="#{myBean.saveValue1}" /> 
    </tr:form> 
    </tr:showDetailItem> 
    <tr:showDetailItem text="Second tab"> 
    <tr:form> 
     <tr:inputText label="Value 2" value="#{myBean.someValue2}" required="true" /> 
     <tr:commandButton text="Save Value 2" actionListener="#{myBean.saveValue2}" /> 
    </tr:form> 
    </tr:showDetailItem> 
</tr:panelTabbed> 

由於這個錯誤也發生在我有我的TR內沒有內容:表單標籤,所以它無關,與我自己的Java bean

我發現了TR:panelTabbed必須放在一個TR內:表格標籤,因爲其他表格標籤中的一個表格標籤是不允許的(這再次導致上述異常),我將我的代碼更改爲:

<tr:form> 
    <tr:panelTabbed> 
    <tr:showDetailItem text="First tab"> 
     <tr:inputText label="Value 1" value="#{myBean.someValue1}" required="true" /> 
     <tr:commandButton text="Save Value 1" actionListener="#{myBean.saveValue1}" /> 
    </tr:showDetailItem> 
    <tr:showDetailItem text="Second tab"> 
     <tr:inputText label="Value 2" value="#{myBean.someValue2}" required="true" /> 
     <tr:commandButton text="Save Value 2" actionListener="#{myBean.saveValue2}" /> 
    </tr:showDetailItem> 
    </tr:panelTabbed> 
</tr:form> 

在首位工作正常,但導致我對我的最後一個問題:

我在每個窗體一些驗證。當用戶嘗試切換到第二個選項卡,而第一個選項卡包含驗證錯誤時,他或她不能這樣做。我想避免這種行爲,但我也想在用戶點擊保存按鈕時驗證當前選項卡的內容。

任何建議如何解決這個問題?

在此先感謝

回答

0

特立尼達有TR:子窗體標籤,可能做什麼您需要,請嘗試使用一個通用TR:form標籤和一個小TR:子窗體每個面板裏面(我希望你想驗證單獨的表格)。

+0

太好了,解決了我的問題:) – w4rumy

相關問題