简体   繁体   中英

Passing a value Grails

Im trying to pass a value from a gsp to a controller. But I keep getting undefined as my value. Im not sure what I am doing wrong here. So I am using this

 <selectBox id ="sb" onchange="${remoteFunction(action: 'Report', params: '\'value=\' + this.value')}">

Then I have

 def Report() {
      def value1 = params["value"]

in my controller

If any one can help or point me in the right direction it would be much appreciated. i am new to Grails.

your action needs to be

def Report = {
    String value = params.value
}

but use lower case for action names. Also the action needs to be in the same controller.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM