【问题标题】:Nested properties enigma in StripesStripes 中的嵌套属性之谜
【发布时间】:2012-03-27 08:02:16
【问题描述】:

我有这些模型(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: 无法解析属性:merchant.participant.partid of: com.hpal.model.Terminal

【问题讨论】:

    标签: java hibernate properties nested stripes


    【解决方案1】:

    尝试在您的 partid 之前添加一个公众。因为类属性的默认行为是限制对同一包中其他类的访问。

    或者使用您的 getter 和 setter 并将其设为私有。

    【讨论】:

    • 实际代码比我发布的代码要详细得多。上面的代码只是为了尽量减少解释情况的工作量。所以是的,修饰符(公共,私人)已经设置
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-25
    • 2017-11-29
    • 1970-01-01
    相关资源
    最近更新 更多