Last updated by admin 4 years ago
?? - createLink
?? Description
Creates a link that can be used where necessary (for example in an href, javascript, ajax call etc.) ????????????????? (?????href,javascript, ajax call ??)????? Parameters
- action (??) - ?????????????????????????????????????????the name of the action to use in the link, if not specified the default action will be linked
- controller (??) - ???????????????????????????????????????????the name of the controller to use in the link, if not specified the current controller will be linked
- id (??) - ????????id?The id to use in the link
- url (??) - action,controller,id????Map?A map containing the action,controller,id etc.
? Examples
Example controller for an application called "shop": "shop"??????????????????????????class BookController {
def defaultAction="list"
def list = { [ books: Book.list( params ) ] }
def show = { [ book : Book.get( params['id'] ) ] }
}<g:createLink action="show" id="1" /> == /shop/book/show/1 <g:createLink controller="book" /> == /shop/book <g:createLink controller="book" action="list" /> == /shop/book/list <g:createLink url="[action:'list',controller:'book']" /> == /shop/book/list
<a href="${createLink(action:'list')}">my link</a>
<a href="/shop/book/list">my link</a>



