【问题标题】:How can i use formRemote feature in my grails app我如何在我的 grails 应用程序中使用 formRemote 功能
【发布时间】:2016-08-26 13:41:55
【问题描述】:

我在 gsp 中使用 formRemote 并调用控制器方法,在该方法内部我调用服务类并且我正在执行我的保存操作。但问题是成功保存后我的更新 div 不起作用

【问题讨论】:

  • 你能显示你的gsp页面代码吗?那么只有我能理解确切的问题。

标签: grails


【解决方案1】:
  • 你的表格应该是这样的

    <g:formRemote  method="post"
         update="updateThisDiv"
        name="formRemote" url="[ controller: 'main', action:'myAction']">
        //your form fields
    </g:formRemote>
    
    <div id="updateThisDiv"></div>
    
  • "updateThisDiv" 是 html 对象的 id,您希望在提交后呈现(但这不是强制性的)。

控制器

def myAction() {
  //TODO: your logic..
  render "Your view" //you can render jsp view, json etc..
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-30
    • 1970-01-01
    相关资源
    最近更新 更多