Reputation: 1458
I'm learning Grails from the Definitive Guide (2nd ed), and get stuck on the Urlmapping used.
I'm buidling the gTunes store, as many before me must have done.
The book makes me change the default mapping in:
class UrlMappings {
static mappings = {
"/"(controller:"store")
}
}
On the form rendered by the "store"'s default action, there is this code:
<div id="registerPane">
Need an account?
<g:link controller="user" action="register">Signup now</g:link>
to start your own personal Music collection!
</div>
clicking, the server returns the message "The requested resource (/gTunes/user/register) is not available."
I have a register.gsp in NetBeansProjects\gTunes\grails-app\views\user
If I change the UrlMappings to it's original, click on StoreController in the original Homepage, and then click SignUp it works. So the problem lies in the mapping used as specified in the book. I found the ERRATA for the first but not for the second edition.
Upvotes: 0
Views: 333
Reputation: 904
This is not in the book, but the solution here fixes the problem. The book apparently uses 1.1 version of grails.
Upvotes: 0
Reputation: 360
Sorry, missed a ? after action:
class UrlMappings {
static mappings = {
"/"(controller:"store")
"/$controller/$action?/$id?"{
constraints{
}
}
}
}
Upvotes: 1
Reputation: 360
Your URLMappings seems incomplete. it should be:
class UrlMappings {
static mappings = {
"/"(controller:"store")
"/$controller/$action/$id?{
constraints{
}
}
}
}
Upvotes: 0