Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates Grails字段插件使用字段模板问题_Templates_Grails_Plugins_Field - Fatal编程技术网

Templates Grails字段插件使用字段模板问题

Templates Grails字段插件使用字段模板问题,templates,grails,plugins,field,Templates,Grails,Plugins,Field,不幸的是,我找不到任何使用Grails字段插件的好例子。 在我的应用程序中,我希望有一些字段呈现为不同的类型,如文本区域或稍后的CKE编辑器。我的域名: class Case { String description } 我创建了一个由插件找到的_input.gsp: 信息formfields.FormFieldsTemplateService-找到模板/补丁盒/说明/输入 它包括: <f:field bean="Case" property="description"

不幸的是,我找不到任何使用Grails字段插件的好例子。 在我的应用程序中,我希望有一些字段呈现为不同的类型,如文本区域或稍后的CKE编辑器。我的域名:

class Case {    
    String description
}
我创建了一个由插件找到的_input.gsp: 信息formfields.FormFieldsTemplateService-找到模板/补丁盒/说明/输入

它包括:

<f:field  bean="Case" property="description">
  <g:textArea name="description" cols="40" rows="5" maxlength="5000" value="some default text"/>
</f:field>
不管我得到什么

ERROR errors.GrailsExceptionResolver  - NotReadablePropertyException occurred when processing request: [GET] /M3PatchManage/patchCase/create
Invalid property 'description' of bean class [java.lang.String]: Bean property 'description' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?. Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:form>: Error executing tag <f:all>: Error executing tag <f:field>: Invalid property 'description' of bean class [java.lang.String]: Bean property 'description' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
有谁能描述一下如何使用自定义字段,或者给一个链接一个好的描述插件doc是很薄的


我使用的是Grails2.4。

我认为您的问题在于bean=Case属性。fields插件似乎试图呈现字符串大小写的属性,而不是大小写类的实例

您应该将案例实例的模型键名称或实例本身传递给此属性。我想以下两种方法都可以:bean=case或bean=${case}

下面是广泛使用fields插件的示例。插件模板的一些示例字段是,下面是使用它们的示例字段

您会注意到,在几乎所有情况下,输入字段都作为f:field标记的主体传递,例如

<f:field bean="competition" property="code" label="Code">
  <g:textField name="${property}" value="${value}" class="input-xlarge" maxlength="191"/>
</f:field>
这可以更简洁地表述为:

<f:field bean="competition" property="code" label="Code" 
        input-class="input-xlarge" input-maxlength="191"/>

我认为您的问题在于bean=Case属性。fields插件似乎试图呈现字符串大小写的属性,而不是大小写类的实例

您应该将案例实例的模型键名称或实例本身传递给此属性。我想以下两种方法都可以:bean=case或bean=${case}

下面是广泛使用fields插件的示例。插件模板的一些示例字段是,下面是使用它们的示例字段

您会注意到,在几乎所有情况下,输入字段都作为f:field标记的主体传递,例如

<f:field bean="competition" property="code" label="Code">
  <g:textField name="${property}" value="${value}" class="input-xlarge" maxlength="191"/>
</f:field>
这可以更简洁地表述为:

<f:field bean="competition" property="code" label="Code" 
        input-class="input-xlarge" input-maxlength="191"/>

我也经历过同样的问题。尝试使用bean=${class}而不是bean=class。
在类中输入您试图创建的类的名称

我也遇到过同样的问题。尝试使用bean=${class}而不是bean=class。
在类中输入您试图创建的类的名称

谢谢!现在有了in_input.gsp就行了!正如我上面解释的,您应该尽量避免将输入字段的标记添加到Thank you!现在有了in_input.gsp就行了!如上所述,您应该尽量避免将输入字段的标记添加到