0

我有一组stream视频,它们具有district它们所属的外键。但是,然后我单击editdelete按钮,我得到了;

Error 2012-08-30 23:51:16,424 [http-bio-8080-exec-7] ERROR errors.GrailsExceptionResolver  - MissingMethodException occurred when processing request: [GET] /ctv/stream/list
No signature of method: ctv.Stream.findAllByDistrict() is applicable for argument types: () values: []
Possible solutions: findAllByDistrict([Ljava.lang.Object;). Stacktrace follows:
Message: No signature of method: ctv.Stream.findAllByDistrict() is applicable for argument types: () values: []
Possible solutions: findAllByDistrict([Ljava.lang.Object;)

问题是因为

<g:form>
  <g:hiddenField name="id" value="${streamInstance?.id}" />
  <span class="button"><g:actionSubmit class="edit" action="edit" id="${params['district']}" value="${message(code: 'default.button.edit.label', default: 'Edit')}" /></span>
  <span class="button"><g:actionSubmit class="delete" action="delete" id="${params['district']}" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
</g:form>

我正在尝试将districtid 发送到edit页面,但我无法做到。有人可以帮我吗?假设district=10,那么我需要10通过<g:actionSubmit>标签传递值。我怎么能那样做?

4

2 回答 2

0

我认为actionSubmit标签不支持 id 参数。它只支持行动和价值。

您必须将地区 id 放在隐藏字段中

<g:hiddenField name="district" value="${params['district']}" />
于 2012-08-31T08:49:55.363 回答
0

使用简单的 g:link<g:link action="edit" id="${streamInstance.id}" >这里不需要 g:form。还要检查您的控制器设置。

class MakeAppController {
static allowedMethods = [ update: "POST", delete: "GET",save: "GET"]

因为 Grails 框架允许在控制器中检查请求。

于 2012-08-31T12:08:48.713 回答