簡體   English   中英

條紋中的嵌套屬性之謎

[英]Nested properties enigma in Stripes

我有這些模型(POJO)

class Participant {
     String partid;

     //getter setter
     //and other old plain POJO methods
}

class Merchant {
     Participant participant;
     //getter setter
     //and other old plain POJO methods
}

class Terminal {
     Merchant merchant;
     //getter setter
     //and other old plain POJO methods
}

還有一個帶有過濾功能的控件視圖類

 ListTerminal implement ActionBean {
      ...
      Terminal terminal;
      //getter setter
      ...
 }

然后在.jsp上我寫了這樣的東西

list_terminal.jsp

...
<td><s:text name="terminal.merchant.participant.partid" /></td>
...

但是然后彈出一個錯誤

org.hibernate.QueryException:無法解析屬性:com.hpal.model.Terminal的merchant.participant.partid

嘗試在您的partid之前添加一個公眾。 因為類屬性的默認行為是限制對同一包中其他類的訪問。

或者使用您的獲取器和設置器並將其私有。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM