grails - 如何在 View 中将值从 View 传递到 Controller

标签 grails button view controller action

我需要将Id值传递给 Controller ​​以执行操作。当前,这就是我 Controller 中的内容。

    def StartServer() {
    amazonWebService.ec2.startInstances(new StartInstancesRequest([InstanceToStart]))
    redirect action: index()
    }
InstanceToStart值将来自 View 。在我看来,我有一个包含以下各列的表格,分别是ID和button:
i-333dced <Button>
i-dhdhdhd <Button>
i-er32ws  <Button>

当我按下按钮时,我希望Id通过,然后执行我的操作。我的按钮代码如下:
  <g:link action="StartServer">
  <input type="button" value="Start Server" class="stopimg" id="startServer"/>
  </g:link>

最佳答案

  • createLink
  • remoteLink
  • remoteFunction

  • 根据需要使用上面的任何人。我敢打赌,如果您进行搜索,您还会在此处获得与相同要求相关的示例/问题/答案。

    关于grails - 如何在 View 中将值从 View 传递到 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16677687/

    相关文章:

    grails - Grails:禁用外键约束

    security - Grails Spring Security LDAP插件:使用LDAP进行身份验证,但仅允许存储在数据库中的用户登录

    html - 2 行按钮值

    android - 自定义按钮将在单击时更改文本颜色、背景颜色和可绘制对象

    sql - Oracle 11g CREATE VIEW 使用 CONNECT BY 和多个表

    mysql - 从单个表中仅在一行中添加多行

    grails - EJB从grails到glassfish的调用

    grails - 在抽象域上使用Grails createCriteria

    android - 无法在 Android 中启用单击的禁用按钮

    android自定义 View 重绘