String _strMod = "com.test.bean.static.initString()" ;
String strPart = "01" ;
String strPart2 = "05" ;
com.test.bean.static.initString()
static是一个类
initString()是一个方法,
strPart
strPart2
是这两个类所需要的参数;
我在前台能只得这到些信息,我何能通过这个字符串起用起static.initString(strPart ,strPart2 )
这个方法出来
---------------------------------------------------------------
PropertyDescriptor descriptor = null;
BeanInfo beanInfo = null;
try {
beanInfo = Introspector.getBeanInfo("com.test.bean.static");
descriptor = descriptors = beanInfo.getPropertyDescriptors();
} catch (Throwable t) {
descriptor = null;
}
Method[] name = descriptor.getMethods();
for(int i=0;i<name.length;i++){
if (name[i].equals("initString")) {
Object[] args = new Object[1];
args[0] = "strPart1";
args[0] = "strPart2" ;
name[i].invoke(bean,args);
}
}
// Obtain value to be set
}