//obj调用方法的对象名 str为a.b.c.d,会调用obj对象的b方法,用返回值调用c方法,以依次类推 不调用a方法,因为再struts里面a为对象名称
public Object geterMethodInvoke(String str,Object obj){
String fieldstrs[]=str.split("\\.");
boolean b=true;
Object returnvalue=null;
try {
for(String s:fieldstrs){
if(b)
b=false;
else if(returnvalue==null){
returnvalue=obj.getClass().getMethod("get" + FormatUtil.toUpperCaseFirstOne(s), new Class[] {})
.invoke(obj, new Object[] {});
}
else{
returnvalue=returnvalue.getClass().getMethod("get" + FormatUtil.toUpperCaseFirstOne(s), new Class[] {})
.invoke(returnvalue, new Object[] {});
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return returnvalue;
}