gpt4 book ai didi

grails - 在标记的属性内使用scriptlet或EL(Grails UI插件)

转载 作者:行者123 更新时间:2023-12-02 15:36:02 25 4
gpt4 key购买 nike

我想在gsp中的不同ID上触发相同的对话框。
所以这是代码:

 <div class="yui3-widget-bd">
<g:each in="deployments" status="index" var="workflow">
<% def id = "reloadFile"+index %>
<gui:dialog title="Reload File" form="true" modal="true"
controller="admin" action="reloadFile"
triggers="[show:[id:'${id}', on:'click']]">
<p>To reload the file, please...</p><br />
<input type="file" id="deploymentFile" name="deploymentFile" />
</gui:dialog>
</g:each>
</div>

问题是scriptlet代码:
triggers="[show:[id:'<%=id %>', on:'click']]"

没有得到评估。
侦听生成的html源中的事件的Javascript部分如下所示:
 YAHOO.util.Event.addListener("${id}", "click", GRAILSUI.gui_e0100d149e0a7b531017e0decaee9fce.show, GRAILSUI.gui_e0100d149e0a7b531017e0decaee9fce, true);

那么我该如何管理源看起来像这样呢? :
YAHOO.util.Event.addListener("reloadFile1", "click", GRAILSUI.gui_e0100d149e0a7b531017e0decaee9fce.show, GRAILSUI.gui_e0100d149e0a7b531017e0decaee9fce, true);

谢谢。

最佳答案

与jsps相同:

  • 如果要执行一些代码

    <%def something = true%>
  • 如果要使用执行返回

    <%=什么? “这是一个事实陈述”:“这是错误的”%>

  • 请注意,这可能是代码异味,并且代码应在99.9%的情况下属于域, Controller 或taglib。

    Here's the reference documentation for more info.

    关于grails - 在标记的属性内使用scriptlet或EL(Grails UI插件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10331196/

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