2015-09-02 44 views
1

隱藏字段抓取的隱藏字段中的某些變量如何顯示使用struts2的</p> <pre><code><s:hidden name="ABCFormBean.dependentLists[0].lastNameEng" id="h_dependantLastNameEng_id"/> </code></pre> <p>我需要在同一頁面顯示同樣在Struts2

<s:property value="ABCFormBean.dependentLists[0].lastNameEng"/> 

不工作

如何顯示內容?

+0

定義「不起作用」;如果它顯示在隱藏字段中,則應使用屬性標記顯示。 <:屬性值= 「ABCFormBean.depLists [0] .firstNameEng」/秒> –

+0

沒有獲取使用顯示? 2)lastNameEng vs firstNameEng? 3)ABCFormBean應該是aBCFormBean? – user2093576

+0

1)dependentLists VS depLists –

回答

1

不顯示任何內容,因爲屬性值不映射值堆棧中的值。 Bu默認動作位於值棧頂部。如果你映射屬性,他們應該被初始化並且有getter和setter。要顯示

<s:property value="ABCFormBean.depLists[0].firstNameEng"/> 

以下方法調用預計

getABCFormBean().getDepLists().get(0).getFirstNameEng() 

如果你能在操作方法這個值,那麼你就必須由酒店標籤被顯示的值。

+0

我知道這是一個荒謬的問題,因爲這是我第一次使用Struts,並且有完成工作的最後期限。非常感謝你耐心解釋這個概念。 – user2093576

相關問題