ognl表达式中判断字符串常量的注意事项
来源:互联网 发布:linux开机挂载硬盘 编辑:程序博客网 时间:2024/03/29 15:25
// OGNL与单个字符常量做等号判断,会被转成数值型Map<String, Object> context = new HashMap<String, Object>();context.put("id", "1");context.put("name", "z");context.put("sex", "man");System.out.println(context);// 单个字符的数字型字符串System.out.println(getValue("id == '1'", context));// falseSystem.out.println(getValue("id == '1'.toString()", context));// true// 单个字符的非数字型字符串try {System.out.println(getValue("name == 'z'", context));} catch (Exception e) {// 'z'不能被转成数值型,此处会抛出NumberFormatExceptione.printStackTrace();}System.out.println(getValue("name == \"z\"", context));// trueSystem.out.println(getValue("name == 'z'.toString()", context));// true// 不是单个字符的字符串System.out.println(getValue("sex == 'man'", context));// trueSystem.out.println(getValue("sex == \"man\"", context));// trueSystem.out.println(getValue("sex == 'man'.toString()", context));// true
0 0
- ognl表达式中判断字符串常量的注意事项
- struts2中用OGNL表达式定义字符串常量与单个字符常量需要注意的一个小细节
- ognl表达式注意事项
- 正则表达式中查找字符串常量
- struts2 中 OGNL表达式的使用
- struts2 中 OGNL表达式的使用
- Struts2 中OGNL表达式的用法
- struts2中OGNL表达式的使用
- sruts2中ognl表达式的原理
- struts2中ognl表达式的运用
- Struts2中Ognl表达式的使用
- Struts2框架中OGNL表达式的学习
- Struts中OGNL表达式的作用
- Struts2中OGNL表达式的用法
- struts2 中ognl表达式
- struts中OGNL表达式
- struts2中OGNL表达式
- Struts2中OGNL表达式
- 责任链模式
- C语言——浅谈时间
- 深度优先遍历与广度优先遍历
- 年轻?大有所为!——实战一
- 最近使用Spring的一点总结
- ognl表达式中判断字符串常量的注意事项
- Linux网络编程:基于TCP的程序开发
- iOS开发笔记之三十七——OC中父类与子类之间相互调用方法的总结
- 应用程序,任务,进程,线程
- Chrome DevTools(1):神奇的console
- c++中的vector用法
- ipad文件夹管理
- Getting all selected rows in ADF Table with multiple rows selection enabled
- 1.JVM运行数据区