Last updated by admin 3 years ago
?? - link
?? Description
Creates a html anchor tag with the href set to based on the parameters specified ???????????????href???????html??????????????? 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
- params (??) - ?????????????Map? A map containing request parameters
- 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:link action="show" id="1">Book 1</g:link> <g:link controller="book">Book Home</g:link> <g:link controller="book" action="list">Book List</g:link> <g:link url="[action:'list',controller:'book']">Book List</g:link> <g:link action="list" params="[sort:'title',order:'asc']">Book List</g:link>
<%= link(action:'list',controller:'book') { 'Book List' }%><a href="/shop/book/list">Book List</a>



