开发者

Grails button syntax

Hey. I开发者_开发问答s there any special tag like this one:

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

that don't need a form, but instead of a textLink is a button ?


You actually have it half done already. Just like in plain HTML, just put the button INSIDE the tag. You can use the standard button CSS styling from grails.

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!"
}

Here's what it would look like:

Grails button syntax


create a <button> element, or an <img> or <a> element, then use the createLink tag to generate the URL that it requests when clicked


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


you could just put a <div> or <img> in the link tag that is styled to look the way you want...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜