我有一组stream
个视频,其中包含district
所属的外键。
但是,我点击了edit
或delete
按钮,我得到了;
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>
我正在尝试将district
ID发送到edit
页面,但我无法做到。有人可以帮帮我吗?假设district=10
,那么我需要通过10
标记传递值<g:actionSubmit>
。我怎么能这样做?
答案 0 :(得分:0)
我认为actionSubmit标记不支持id参数。它只支持行动和价值。
您必须将区域ID放在隐藏字段中
<g:hiddenField name="district" value="${params['district']}" />
答案 1 :(得分:0)
使用简单的g:link <g:link action="edit" id="${streamInstance.id}" >
这里不需要g:form。
还要检查您的控制器设置。
class MakeAppController {
static allowedMethods = [ update: "POST", delete: "GET",save: "GET"]
因为Grails框架允许在控制器中检查请求。