Search This Blog

Friday, August 22, 2014

How to Comment the section / paragraph / set of lines in Grails GSP ?

html



grails [ .gsp ]

<%--
         stmt 1
         stmt 2
         ---
--%>

grails [ .groovy ]

// stmt1

or

/*
stmt1
stmt2
*/
 

Grails : How to pass or get param values in g:createLinks

in view.GSP





in YourController.gsp

def displayImageOnFileName ()
    {
        print params
        String fileName = params.fileName        // or params["fileName"]
...
}

Grails Configuring your own Bean or Groovy Object

Configuring Additional Beans

Using the Spring Bean DSL

You can easily register new (or override existing) beans by configuring them in grails-app/conf/spring/resources.groovy which uses the Grails Spring DSL. Beans are defined inside a beans property (a Closure):
 
beans = {
    // beans here
}
 
As a simple example you can configure a bean with the following syntax:
import my.company.MyBeanImpl
beans = { myBean(MyBeanImpl) { someProperty = 42 otherProperty = "blue" } }
Once configured, the bean can be auto-wired into Grails artifacts and other classes that support dependency injection (for example BootStrap.groovy and integration tests) by declaring a public field whose name is your bean's name (in this case myBean):
 
class ExampleController {
def myBean … }


Referencing Existing Beans

Beans declared in resources.groovy or resources.xml can reference other beans by convention. For example if you had a BookService class its Spring bean name would be bookService, so your bean would reference it like this in the DSL:
beans = {
    productUtility ( ProductUtility )
            {
          someProperty = 42
          otherProperty = "blue"
          springSecurityService = ref ( "springSecurityService" )
            }
}
or like this in XML:
"myBean" class="my.company.MyBeanImpl"> 
"someProperty" value="42" />
    "otherProperty" value="blue" />
  "springSecurityService" ref="springSecurityService" />
The bean needs a public setter for the bean reference (and also the two simple properties), which in Groovy would be defined like this:
package my.company
class MyBeanImpl { Integer someProperty String otherProperty
   SpringSecurityService springSecurityService  or def springSecurityService 
}




Wednesday, August 13, 2014

Grails Debugging Enable Intelj Idea

Step 1:-
Add in config.groovy

plugin.platformCore.events.catchFlushExceptions = true

Step 2:-
Add in buildconfig.groovy

grails.project.fork = [
        test: false,
        run: false
]



That's It, 
 Just run in debug mode..  [ click debug button, instead of run button/from menu]

Hit Counter


View My Stats