gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 14:58:56 24 4
gpt4 key购买 nike

我需要将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/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com