Make sure you return something from your grails actions!

In my grails application, I didn't understand how "index" action was being invoked from another action:


    def about = {

    }
    def index = {
println "hello"
    }

Calling my "about" action was invoking the "index" action. Make sure you return something in your action if this is not your intention, Well this may seem like a "duh", when you got filters/actions and tons of stuff going on in your application, it took me a while to figure this out.

Here is correct way:

    def about = {
[:]
    }
    def index = {
println "hello"
    }

 

Comments

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options