ShurikAg
Dec 3rd, 2010, 03:06 PM
Hi,
First, I have to say that I'm new for Grails :) So, some "trivial" questions are possible :)
In my app I have a UrlMapping as follows:
class UrlMappings {
static mappings = {
name dashboard: "/" {
controller = "dashboard"
action = "index"
}
name login: "/login"(controller:"auth"){
action = [GET:"login", POST:"loginDo"]
}
"500"(view:'/error')
}
}
When in one of my controllers I'm trying to redirect to the login page like this:
redirect(controller: 'auth', action:'login')
it redirects me to: http://host/auth/login
1. What is the right way to generate the link defined in the mapping?
2. How can I use the name of named mapping to generate the url's (not links)?
I found a way to generate a links:
<g:link mapping="personList">List People</g:link>
Didn't find anything similar for URLs only...
Thanks.
First, I have to say that I'm new for Grails :) So, some "trivial" questions are possible :)
In my app I have a UrlMapping as follows:
class UrlMappings {
static mappings = {
name dashboard: "/" {
controller = "dashboard"
action = "index"
}
name login: "/login"(controller:"auth"){
action = [GET:"login", POST:"loginDo"]
}
"500"(view:'/error')
}
}
When in one of my controllers I'm trying to redirect to the login page like this:
redirect(controller: 'auth', action:'login')
it redirects me to: http://host/auth/login
1. What is the right way to generate the link defined in the mapping?
2. How can I use the name of named mapping to generate the url's (not links)?
I found a way to generate a links:
<g:link mapping="personList">List People</g:link>
Didn't find anything similar for URLs only...
Thanks.