BeanUtils.copyProperties ()는 가방마다 사용법이 다릅니다!!!명심하라!!!
2406 단어 BeanUtilscopyProperties
import org.springframework.beans.BeanUtils;포장:
<span style="white-space:pre"> </span>// vo po
<span style="white-space:pre"> </span>/**
<span style="white-space:pre"> </span>* <span style="font-family: Arial, Helvetica, sans-serif;"><span style="color:#ff0000;">BeanUtils.copyProperties(source, target);</span> !</span>
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="white-space:pre"> </span> * <span style="color:#ff0000;">VO ,PO </span></span>
<span style="white-space:pre"> </span>*/
<span style="font-family: Arial, Helvetica, sans-serif;">BeanUtils.copyProperties(this.getModel(),sysUserGroup);</span>
4
//BeanUtils.copyProperties(SysUserGroupForm(vo ), sysUserGroup(po );
용법2:import org.apache.commons.beanutils.BeanUtils;포장:
<span style="white-space:pre"> </span>//VO--->PO
<span style="white-space:pre"> </span>/**
<span style="white-space:pre"> </span>* <span style="font-family: Arial, Helvetica, sans-serif;"><span style="color:#cc0000;">BeanUtils.copyProperties(dest, orig); </span> !</span>
<span style="white-space:pre"> </span>*<span style="white-space:pre"> </span> <span style="color:#ff0000;"> PO ,VO </span>
<span style="white-space:pre"> </span>*/
4
BeanUtils.copyProperties(sysUser, sysUserForm);
또한:프로젝트에서 시간 변환은 다음과 같습니다.
속함: import org.apache.commons.lang.time.DateFormatUtils;포장:
String curDate = DateFormatUtils.format(new java.util.Date(), "yyyy-MM-dd HH:mm:ss");
요약:
방법을 쓸 때는 반드시 가방에 주의해야 한다!