Illep
Illep

Reputation: 16841

Error while passing values to another controller function

My controller function is as follows:

  def saveData(String name,String message) { 
     println "HI WORLD"
     println "NAME IS "+ name
     println "NAME IS "+ message
  }

From another controller function I'm passing values to the above controller function:

def submitMessage() {
    def mes =new Message()
    mes.saveData("HI","JJ")    
}

I end up having the following error, how can I resolve it?

Message: No signature of method: myPro.Message.saveData() is applicable for argument types: (java.lang.String, java.lang.String) values: [HI, JJ]

Upvotes: 0

Views: 134

Answers (1)

Jeff Scott Brown
Jeff Scott Brown

Reputation: 27200

Your subject suggests that you are invoking a method on a controller but your code and error message indicate that you are invoking a method on an instance of myPro.Message, which is not a controller. You should verify that there is a saveData method in your myPro.Message class that accepts 2 String arguments.

Upvotes: 1

Related Questions