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