
Originally Posted by
luisfrps
Hello all,
Does anyone know the sintaxe for accessing a java class inside a controller in Grails
I needed to pass the information I have of an object defined in a java package of a Grails project for the controller and vice versa
Many thanks for you support
Regards
Luis Silva
The syntax for accessing a Java class from a Grails controller is the exact same as the syntax for accessing a Groovy class from a Grails controller. There is no difference.
Code:
class MyController {
def someControllerAction() {
// the Widget class referenced here could be written in Java,
// Groovy, Scala or just about any other JVM language
def widget = new com.myapp.Widget()
widget.doSomethingUseful()
// ...
}
}