There is no getter for property named 'xxxx' in 'class xxxx , ${}与@param一起用

如果 parameterType 传输单个简单类型值,${}括号中只能是 value。

如果写${id}要给参数设置@param("id"),否则会报错:There is no getter for property named 'xxxx' in 'class xxxx

 

${}源码:

${}源码:

```java
textsqlnode
public String handleToken(String content) {
      Object parameter = context.getBindings().get("_parameter");
      if (parameter == null) {
        context.getBindings().put("value", null);
      } else if (SimpleTypeRegistry.isSimpleType(parameter.getClass())) {
        context.getBindings().put("value", parameter);
      }
      Object value = OgnlCache.getValue(content, context.getBindings());
      String srtValue = (value == null ? "" : String.valueOf(value)); // issue #274 return "" instead of "null"
      checkInjection(srtValue);
      return srtValue;
    }
```

源码中指定了读取的 key 的名字就是”value”,所以我们在绑定参数时就只能叫 value 的名字了。

 


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章