Propertyutils. getproperty usage:
Obtains the value of the getxxx method.
Propertyutils. setproperty usage:
Set its value relative to the setxxx method.
Import java. Lang. Reflect. invocationtargetexception;
Import org. Apache. commons. beanutils. propertyutils;
Import VO. user;
Public class test1 ...{
/***//**
* @ Param ARGs
*/
Public static void main (string [] ARGs )...{
// Todo auto-generated method stub
Try ...{
User AAB = new user ();
Propertyutils. setproperty (AAB, "username", "12 ");
System. Out. println (propertyutils. getproperty (AAB, "username "));
} Catch (illegalaccessexception e )...{
// Todo auto-generated Catch Block
E. printstacktrace ();
} Catch (invocationtargetexception e )...{
// Todo auto-generated Catch Block
E. printstacktrace ();
} Catch (nosuchmethodexception e )...{
// Todo auto-generated Catch Block
E. printstacktrace ();
}
}
}