Grails:在g上执行params:单击actionSubmit

时间:2015-06-15 10:46:44

标签: grails gsp

单击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按钮时如何结转参数?

1 个答案:

答案 0 :(得分:3)

我认为您不能以params方式通过actionSubmit。您可以使用g:form tagparams属性,例如

<g:form params="${params}">
    ...
</g:form>

<g:form params="[offset: params.offset, max: params.max]">
    ...
</g:form>