How do I call a Grails service from a gsp?

Best to use the tag library because creating a service instance directly in the view via the class loader WILL NOT autowire other services declared that may live in the service you are trying to use. Using the tag library you will have auto-wiring of those services. In your gsp view <g:customTag param1=”$modelObjec” param2=”someString” /> … Read more

Are there any good tutorials for using sitemesh in a grails application?

the g:pageProperty is a very powerful, but very poorly documented thing. Lets say in my layout I specify where to put some content like this: <html> <body> <g:pageProperty name=”page.header” /> </body> Now in my page I can specify some content: <content tag=”header”> <!– header –> </content> Sitemesh will take the content tag, regardless of actual … Read more

What does the question mark mean in GSP/Grails?

It’s the “Safe Navigation Operator”, which is a Groovy feature that concisely avoids null pointer exceptions. See http://docs.groovy-lang.org/latest/html/documentation/index.html#_safe_navigation_operator In this case, if phoneInstance is null, then it doesn’t try to get the name property and cause a NPE – it just sets the value of the field tag to null.

Overriding grails.views.default.codec=’html’ config back to ‘none’

To summarize the various levels at which the codec can be applied: Set Config.groovy’s grails.views.default.codec=”html” to get HTML escaping by default on all ${expressions} in the application. Then when you want to default a whole page back to none, use the directive: <%@page defaultCodec=”none” %> or <%@ defaultCodec=”none” %> To disable HTML encoding for one … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)