grails - 如何从 Controller 传递变量的值以查看grails?

标签 grails view controller

我需要从 Controller 传递来查看的状态码。我的查看代码具有if / else条件。

<g:if test="${code=='something'}">
 <g:link action="StartServer">
    <input type="button" value="Start Server" class="stopimg" id="startServer" />
</g:link>
</g:if>
   <g:else>
       <g:link action="StopServer">
           <input type="button" value="Stop Server" class="runimg" id="stopServer" />
       </g:link>
   </g:else>

我需要从code获取controller,我的代码值在里面
def index() {}

我该如何实现?

最佳答案

在 map 中返回您需要的所有内容。

def index {
...
return [code:variableContainingCode]
}

关于grails - 如何从 Controller 传递变量的值以查看grails?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16572237/

相关文章:

grails - 如何在使用 grails 的 Jenkins CI 上配置测试报告?

maven - Grails 2.2.x - 使用多个自定义存储库的依赖关系解析

JavaFX如何在不同窗口中的两个 Controller 之间进行通信

asp.net-mvc - 可以使用 ASP.NET MVC 创建 "controller-less"url 吗?

asp.net-mvc - 我们可以在 RedirectToAction 中将模型作为参数传递吗?

grails - 域对象属性列表,不包括关联

grails - 使用 Grails 将屏幕截图转化为原型(prototype)

view - 蛋糕php : Check if view element exists

ios - 更改标题 View iOS

mysql - 哪个是更快的 View 或子查询?