Grails params没有通过

时间:2016-01-08 22:54:29

标签: grails

我有一个grails控制器:

import grails.converters.JSON
import grails.transaction.Transactional

class ProfileController {
  static allowedMethods = [index: "GET", update: "PUT"]

  def index() {
    println "inside index"
    //...
  }

  @Transactional
  def update(Profile profile) {
    println "inside update"
    println "thing ${profile}"
    println "params ${params}"
    //...
  }
}

使用以下URL映射:

    '/profile'(controller: 'profile', action: 'index', method: 'GET')
    '/profile'(controller: 'profile', action: 'update', method: 'PUT')

不幸的是,对于个人资料或参数的PUT行动没有任何结果。

我通过以下方式点击它:

curl 'http://localhost:8080/profile' -X PUT --data-binary '{"phoneNumber":"020-30303030"}'

运行我看到:

 inside update
 thing null
 params [controller:profile, action:update]

知道为什么params和/或profile数据绑定没有填充数据吗?

0 个答案:

没有答案
相关问题