【问题标题】:values cannot be entered for List<String> in create page of grails无法在 grails 的创建页面中为 List<String> 输入值
【发布时间】:2014-05-27 05:59:34
【问题描述】:

这是域类:

package com.sample

class Person {
       String id
       String name
       Integer age
       Address address
       List children
  static hasMany = [pets:Pet, children: String, aliases : Alias]

  static mapWith = "mongo"
  static constraints = {
           address nullable:true
  }
}

这是应用的创建页面:

谁能告诉我如何在创建人员页面中获取要写入的列表以及在编辑人员页面中可编辑的列表。 (我正在使用命令 grails generate-view com.sample.Person 生成的视图)

【问题讨论】:

  • 将孩子设为 ENUM

标签: mongodb grails grails-orm grails-plugin grails-domain-class


【解决方案1】:

首先,您不需要域类中的List children。但我不确定 grails 是否支持与基本非域类型(在您的情况下为String)的关系搭建脚手架。如果删除列表无济于事,您将需要手动处理这种情况。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多