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 的名字了。

 


 

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