[英]Struts 1.2: html:options does not find a collection from a bean
我有一個Struts頁面,該頁面在JSP中以表格形式顯示以下內容:
<html:select property="value">
<html:options collection="valueNext"/>
</html:select>
在Java形式中,吸氣劑都存在:
public AValue getValue() {
return value;
}
public List<AValue> getValueNext() {
return value.next();
}
但是,當我嘗試顯示頁面時,總是出現一條錯誤消息,告訴我以下內容:
在名稱值下找不到bean
我不明白為什么Struts會找到value
而不是valueNext
(是的,我已經刪除了html:options
行,並且可以使用)。
我對Struts並不陌生,但在我看來兩者都在同一個范圍內。 有人可以啟發我嗎?
我終於找到了(由於另一個貢獻者的幫助)。
我沒有使用正確的標記:調用另一個bean時將使用html:options
。
要調用表單的屬性,我應該改用html:optionsCollection
。 以下JSP可以正常工作:
<html:select property="value">
<html:optionsCollection property="valueNext"/>
</html:select>
(Struts文檔: html:options和html:optionsCollection )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.