Monday 15 June 2015

groovy - Grails urlMappings action and controller behavior not using controller logic -



groovy - Grails urlMappings action and controller behavior not using controller logic -

i have grails app content of urlmappings.groovy file is:

"/" { controller="home" view="home" }

my home controller looks

class homecontroller { list products = [ ['price': 100, 'desc':'a'], ['price': 200, 'desc':'b'] ] def home() { [products: products] }

when navigate localhost:8080/myproject/home/home, have access "${products}", when navigate localhost:8080/myproject, "${products}" statement null.

why , how can create localhost:8080/myproject deed same way localhost:8080/myproject/home/home?

you should do

"/"(controller: 'home', action: 'home')

grails groovy gsp grails-controller

No comments:

Post a Comment