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