Home UrlMapping to Index is not working
Reply: 1

UrlMapping to Index is not working

Devin Harris
1#
Devin Harris Published in 2017-12-05 02:11:03Z

I am trying to get my Index which in my case is just localhost:8080 to go to a different page. This code is not working and I'm just going to the index page instead of rendering "this worked"

My UrlMappings file looks like this:

package appworld

class UrlMappings {

    static mappings = {

        "/$controller/$action?/$id?(.$format)?"{
            constraints {
                // apply constraints here
            }
        }

        "/" {
            controller = "Home"
            action = "isUserLoggedIn"
        }

        "500"(view:'/error')
        "404"(view:'/notFound')
    }
}

The method in HomeController.groovy looks like:

def isUserLoggedIn() {
   println("We made it from index")
   render "this worked"
}
augustearth
2#
augustearth Reply to 2017-12-05 03:01:48Z

It looks like your syntax is off. Try:

"/"(controller:"home", action:"isUserLoggedIn")
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.315053 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO