Hi,
I have gone through some grails article and find out the following way to pass a variable to GSP from the Controller:
As per the Article:
If your action doesn’t explicitly return a model, all the controller’s properties will be
available inside the view. Remember that a controller is created for each request, so this
approach is thread- safe. Here is an example:
class MainController {
String message; def index() {
message="Welcome to the Grrovy&Grails Forum"
}
}
The variable message is now accessible inside grails-app\views\main\index.gsp as
follows:
<html>
<head><title>Main</title></head>
<body> ${message}</body>
</html>
But it's not working, I am using Grails 2.0.4.
Kindly confirm me that can I access the Controller properties in the controller respective GSP files or not?
Thanks in advance.
Regards,
Baji


Reply With Quote

