问题
With Grails 2.3.4, and scaffold 2.0.1; no object appears in the index
(list) page of the controllers. The views are being automatically created by grails official scaffolding plugin.
I'm positive there actually are objects added, since when creating a object that needs another, the latter appears as an option in the former's creation page.
What appears is the "main" layout and an empty table that would contain the actual data.
One example of a domain class(Bairro) that doesn't appear in it's controller index
action (which is the data listing) .
package webservice.web
class Bairro {
String nome
static belongsTo = [cidade:Cidade]
static constraints = {
nome(nullable:false, maxSize:30)
}
@Override
public String toString() {
return nome
}
}
and it's controller
package siscoserv.web
class BairroController {
def index() { }
static scaffold = true
}
and here is the list of installed plugins
plugins {
build ":tomcat:7.0.47"
compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'
runtime ":hibernate:3.6.10.6" // or ":hibernate4:4.1.11.6"
runtime ":database-migration:1.3.8"
runtime ":jquery:1.10.2.2"
runtime ":resources:1.2.1"
runtime ":database-migration:1.3.8"
runtime ":yui-minify-resources:0.1.5"
}
Thanks
PS: Clarification: No controller works on this action page. I have created 4 similar domain classes and it's respective controllers
回答1:
The problem could be that you are overriding default index action - try just this:
class BairroController {
static scaffold = true
}
来源:https://stackoverflow.com/questions/21386700/domain-class-not-found-in-grails-app-domain