如何从roo uiModel打印值?

时间:2011-04-06 19:24:13

标签: spring-roo

当我在jspx页面中打印uiModel ${subscribers}时。我正在追随:

"[Code: S0001, FirstName: John, 
               LastName: Smith, 
               Message: New subscriber, 
               Active: 1, 
               RouteID: Code: 1, 
               Name: Route 1, 
               Active: 1, 
               TruckID: 
  Code: t1000, 
               Name: Truck 1, 
               Active: 1, 
               DistrictID: 
  Code: dst1, 
               Name: Colombo 1, 
               Active: 1, 
               LastModifiedDate: 2011-04-02 15:40:25.0, 
               LastModifiedUser: admin, 
               LastModifiedDate: 2011-04-02 00:00:00.0, 
               LastModifiedUser: admin, 
               LastModifiedDate: 2011-04-02 00:00:00.0, 
               LastModifiedUser: admin, 
               PaymentTypeID: 

  Code: 1, 
               Name: Cash, 
               LastModifiedDate: 2011-04-02 00:00:00.0, 
               LastModifiedUser: admin, 
               LastModifiedDate: 2011-04-02 00:00:00.0, 
               LastModifiedUser: admin]"

如何仅打印“代码”属性:

我尝试了以下操作,但它打印出空字符串:

${subscribers[Code]}

我还有一个问题。如何发送多个uiModel并在表单中显示并更新它们?

1 个答案:

答案 0 :(得分:0)

通常你推送Roo在文件“[Entityname] _Roo:ToString.aj”中生成的toString方法并重新实现它以便它返回你想要的值。 类似的东西:

public String [Entityname].toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("Code: ").append(getCode());
        return sb.toString();
    }