package sample.pg;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import org.apache.commons.beanutils.*;
public class BeanUtilAction extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
CopyData1 fromData = new CopyData1();
fromData.setId("id01");
fromData.setName("name01");
fromData.setTel("03-3333-3333");
CopyData2 toData = new CopyData2();
// CopyData1のオブジェクト「fromData」から、CopyData2のオブジェクト「toData」にコピーする
PropertyUtils.copyProperties(toData, fromData);
return mapping.findForward("success");
}
}
|