dkim18
asked on
copy pojo bean to struts' action form bean
Hi,
I am trying copy pojo bean to struts' action form bean here.
+++++++++++++++++++
public ActionForward savetest(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws java.lang.IllegalAccessExc eption,
java.lang.reflect.Invocati onTargetEx ception, java.lang.NoSuchMethodExce ption {
Demographics demographics = new Demographics();
DemographicsDAO demographicsDAO = new DemographicsDAO();
DemographicsForm demographicsForm =(DemographicsForm) form;
PropertyUtils.copyProperti es( demographics, demographicsForm);
...
+++++++++++
However, I have java.lang.reflect.Invocati onTargetEx ception. All properties from both(Demographics and DemographicsForm) are the same. Any idea?
thx,
I am trying copy pojo bean to struts' action form bean here.
+++++++++++++++++++
public ActionForward savetest(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws java.lang.IllegalAccessExc
java.lang.reflect.Invocati
Demographics demographics = new Demographics();
DemographicsDAO demographicsDAO = new DemographicsDAO();
DemographicsForm demographicsForm =(DemographicsForm) form;
PropertyUtils.copyProperti
...
+++++++++++
However, I have java.lang.reflect.Invocati
thx,
ASKER
No, it is from org.apache.commons.beanuti ls.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I got this exception.
InvocationTargetException: java.lang.reflect.Invocati onTargetEx ception
getTargetException(): java.lang.StackOverflowErr or
InvocationTargetException:
getTargetException(): java.lang.StackOverflowErr
Well that means that there was an infinite recursion. Print the complete stack-trace of the target-exception using printStackTrace ()
ASKER
Found error and fixed it. I made two getter methods calling each other.
Yes that's indirect recursion.
Are you trying to copy all the attributes from Demographics demographics to DemographicsForm demographicsForm?
If so, can you post your PropertyUtils.copyProperti
David