嘿。有没有像这样的特殊标签:
<g:link controller="xx" action="yy_" id="${it.id}">
</g:link>
不需要表单,但用按钮代替文本链接?
最佳答案
实际上你已经完成了一半。就像在纯 HTML 中一样,只需将按钮放在标签内即可。您可以使用 grails 中的标准按钮 CSS 样式。
view:
<g:link action="toLink">
This is a grails app with a button link without a form or submit. Click this
<input type="button" value="I'm a Button Link" class="button"/>
and it should jump to the action.
</g:link>
controller:
def toLink = {
render "It worked!"
}
它看起来像这样:
关于Grails 按钮语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6118077/