2011-05-24 41 views
2

嘿。有没有像这样的特殊标签:Grails按钮语法

<g:link controller="xx" action="yy_" id="${it.id}"> 
</g:link> 

不需要窗体,而不是textLink是一个按钮?

+0

这不会是新闻人,但它是我一直专注于在过去几天的事:浏览器提供免费链接的右键单击功能(例如,在新标签页中打开)。将一个链接伪装成一个按钮就是隐藏用户的导航功能。 – 2011-05-25 02:08:00

+0

[This looks very similar](http://stackoverflow.com/questions/1356894/how-to-incorporate-a-glink-into-an-ordinary-button) – 2011-05-25 01:34:57

回答

2

创建<button>元素或<img><a>元素,然后用createLink标签生成点击时请求的URL

0

,你可以只是把<div>或者是风格看你想要的方式链接标签<img> ...

9

实际上它已经完成了一半。就像在普通的HTML中一样,只需将INSIDE按钮放入标签即可。您可以使用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!" 
} 

下面是它会是什么样子:

enter image description here

+0

它在IE8中不起作用 – 2013-11-18 13:17:11

0
<g:link controller="home" action="doLogout"> 
    <button type="button">Logout</button> 
</g:link>