2012-03-27 57 views
0

我有这些模型(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的:com.hpal.model.Terminal

回答

0

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

或者使用你的getter和setter并将其设置为private。

+0

实际的代码更详细,然后我会发布。上面的代码只是为了尽量减少解释情况的代码。所以是的,修饰语(公共的,私人的)已经设置好了 – user1191781 2012-03-27 10:01:15