如何在Grails中为单个表单设置多个操作按钮

n92*_*n92 0 forms grails grails-2.0

我有一个表单和操作按钮如下

<g:form  controller="mail"  enctype="multipart/form-data" method="post" id="mailComposer" name="mailComposer">
    <g:submitButton action="sendMail" name="send"  id="send" value="Send" />
    <g:submitButton action="save"  name="save" id="save" value="Save Now" />    
</g:form>
Run Code Online (Sandbox Code Playgroud)

在MailController中,我已经定义save()sendMail()执行了操作.

当我点击任何按钮时,操作被调用不正确,而是转到此URL "http://localhost:8080/myapp/mail/index/mailComposer".

submitToRemote工程的罚款.

我们可以在单一形式中使用不同控制器的多个动作.

我之前在Grails 1.3.x版本中做过这个,但是在Grails 2.0.4中,它就是这样做的.

tim*_*tes 5

不应该使用actionSubmit吗?:

<g:form  controller="mail"  enctype="multipart/form-data" method="post" id="mailComposer" name="mailComposer">
    <g:actionSubmit action="sendMail" value="Send" />
    <g:actionSubmit action="save" value="Save Now" />    
</g:form>
Run Code Online (Sandbox Code Playgroud)