grailsmodel-view-controllerurl-mappingurlmappings.groovy

Grails URL mapping working for controller but not view


Somehow I have gotten sideways with my Grails MVC mapping and I do not understand how.

I have a controller, AController, which I generated using the Grails command line wizard. At a later date I generated a view for that controller to customize the view.

AController is in [project]/grails-app/controllers/[package]/AController.groovy and the view .gsp's are in [project]/grails-app/views/A/.

The URLMappings.groovy has:

    "/$controller/$action?/$id?"{
        constraints {
            // apply constraints here
        }
    }

When I run the application and enter a url of the form: localhost:8080/[project]/A/list I reach, as expected, the method A.list in AController.groovy.

However, when I then return from A.list expecting the framework to route to list.gsp in [project]grails-app/views/A/ I see a 500 error with the message:

"URL mapping must either provide a controller or view name to map to!"

Obviously I am doing something stupid but I cannot see what it was that I broke. URLMappings.groovy looks correct. File locations look correct. Scaffolding seems properly customized.

Any suggestions?


Solution

  • Du-Oh

    The problem was that there was no .count for an array. For some reason my brain insists on .count and not .size(). Stupid human error.