单击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>
这是我的 Controller 代码:
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
按钮之前的URL看起来像:http://localhost:8080/message/list?offset=10&max=100
单击“删除”
g:actionSubmit
按钮后,该URL看起来像(并具有其他参数: 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
按钮时如何继承参数? 最佳答案
我认为您无法以这种方式传递params
和actionSubmit
。您可以使用g:form tag的params
属性,例如
<g:form params="${params}">
...
</g:form>
要么
<g:form params="[offset: params.offset, max: params.max]">
...
</g:form>