Skip to content

Commit 24cedbc

Browse files
author
graeme
committed
fixed error in link tag with reverse url mappings
git-svn-id: https://svn.codehaus.org/grails/trunk@3968 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d
1 parent a570dd6 commit 24cedbc

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/grails/grails-app/taglib/ApplicationTagLib.groovy

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,20 @@ class ApplicationTagLib {
8585

8686
def controller = attrs.remove("controller")
8787
def action = attrs.remove("action")
88-
def params = attrs.remove("params")
88+
def params = attrs.params ? attrs.remove('params') : [:]
8989
def mapping = grailsUrlMappingsHolder?.getReverseMapping(controller,
9090
action,
9191
params)
92-
def url = mapping?.createURL(params)
92+
def url
93+
try {
94+
params.controller = controller
95+
if(action) params.action = action
96+
url = mapping?.createURL(params)
97+
}
98+
finally {
99+
params.remove('controller')
100+
params.remove('action')
101+
}
93102
if(url) {
94103
out << url
95104
}
@@ -143,7 +152,7 @@ class ApplicationTagLib {
143152
}
144153
}
145154
}
146-
out << '>'
155+
out << '>'
147156
out << body()
148157
out << "</${attrs.name}>"
149158
}

0 commit comments

Comments
 (0)