标签:stat span cat block except try value nbsp obj
使用Ognl需要导入两个包:
测试小程序:
package helloWorld;
import ognl.Ognl;
import ognl.OgnlException;
public class TestOgnl {
public static void main(String[] args) {
Person person=new Person();
person.setName("Abby");
try {
Object value=Ognl.getValue("name",person);
System.out.println(value);
} catch (OgnlException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
class Person{
String name="";
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
/////////输出Abby
标签:stat span cat block except try value nbsp obj
原文地址:http://www.cnblogs.com/huche123/p/7368311.html