单击g:actionSubmit
按钮时如何转发参数?
这是我的gsp
代码:
<g:checkBox name="msgCheck" checked="" value="${userInstance.emailId}"></g:checkBox>
...
<g:actionSubmit class="update" action="delete" value="Delete" params="${params}"></g:actionSubmit>
这是我的控制器代码:
def delete() {
try {
def user_list = params.msgCheck
//deleting the user
//successful.
redirect(action: "list", params: params)
} catch (Exception e) {
log.error("Deleted Exception---->>" + e.getMessage())
}
}
params
缺少重定向。我想在params
上结转redirect
。
点击“删除”g:actionSubmit
按钮之前的网址如下:
http://localhost:8080/message/list?offset=10&max=100
点击“删除”g:actionSubmit
按钮后,网址看起来像(并且有额外的参数:
http://localhost:8080/message/list?msgCheck=ga12%40user.com&msgCheck=&_action_domainDelete=Delete&_msgCheck=&_msgCheck=&_msgCheck=&_msgCheck=&_msgCheck=&_msgCheck=&_msgCheck=&_msgCheck=&_msgCheck=&_msgCheck=&_msgCheck=&domainId=1&noofrows=100
单击g:actionSubmit
按钮时如何结转参数?
答案 0 :(得分:3)
我认为您不能以params
方式通过actionSubmit
。您可以使用g:form tag的params
属性,例如
<g:form params="${params}">
...
</g:form>
或
<g:form params="[offset: params.offset, max: params.max]">
...
</g:form>