By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,705 Members | 2,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,705 IT Pros & Developers. It's quick & easy.

How an action1.java can call a method from action2.java?

P: 11
Hi..I am trying to call the method in XC18Action through the xcAction. The error was:

0000002f SystemErr R at org.apache.commons.beanutils.BeanUtilsBean.copyPro perties(BeanUtilsBean.java:221)
0000002f SystemErr R at org.apache.commons.beanutils.BeanUtils.copyPropert ies(BeanUtils.java:114)
0000002f SystemErr R at my.org.hasil.dcms.grq.web.XC18Action.performSedia( XC18Action.java:568)

I dont understand what it wants...

These are the methods :

1.)xcAction.java

Expand|Select|Wrap|Line Numbers
  1. public ActionForward performSedia(ActionMapping mapping, ActionForm form,javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response) {
  2. ActionForward forward = new ActionForward();
  3. HttpSession httpSession = request.getSession();
  4. MESSession session = (MESSession) httpSession.getAttribute(DCMSConstants.DCMSConstants_MESSESSION);
  5. TodoparameterForm todoForm = (TodoparameterForm) httpSession.getAttribute("todoparamForm");
  6.     XC18BO xcbo = new XC18BO(session);
  7.     XC18Form xc18form = new XC18Form();
  8.     XcForm xcForm = (XcForm) form;
  9.  
  10.     try {
  11.     //BeanUtils.copyProperties(xcbo, todoForm);
  12.     BeanUtils.copyProperties(xcbo, xcForm);
  13.     xcbo.setTodo_id(xcForm.getId());
  14.     XC18Action xc18Action = new XC18Action();
  15.     XC18Action.performSedia(mapping, xcForm, request, response);
  16.  
  17.  
  18.         } catch (Exception e) {
  19.             e.printStackTrace();
  20.         }
  21.         forward = mapping.findForward("success");
  22.         return forward;
  23.     }
  24.  
  25. }
2.XC18Action.java

Expand|Select|Wrap|Line Numbers
  1. public static ActionForward performSedia(ActionMapping mapping, ActionForm form,javax.servlet.http.HttpServletRequest request,        javax.servlet.http.HttpServletResponse response) {
  2. ActionForward forward = new ActionForward();
  3. HttpSession httpSession = request.getSession();
  4. MESSession session = (MESSession) httpSession
  5.                 .getAttribute(DCMSConstants.DCMSConstants_MESSESSION);
  6. TodoparameterForm todoForm = (TodoparameterForm) httpSession.getAttribute("todoparamForm");
  7. XC18BO xcbo = new XC18BO(session);
  8. XC18Form xc18form = (XC18Form) form;
  9.  
  10.  
  11. try {
  12. BeanUtils.copyProperties(xcbo, todoForm);
  13. BeanUtils.copyProperties(xcbo, xc18form);
  14. xcbo.setTodo_id(xc18form.getId());
  15. xcbo.setStatus(DCMSConstants.USERTODO_STATUS_SEDIA);
  16. xcbo.processXC18();
  17.         } catch (Exception e) {
  18.             e.printStackTrace();
  19.         }
  20.         forward = mapping.findForward("success");
  21.         return forward;
  22.     }
Please someone tell me how to solve this. Thank u.
Jul 27 '10 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 785
Expand|Select|Wrap|Line Numbers
  1. 0000002f SystemErr R at my.org.hasil.dcms.grq.web.XC18Action.performSedia( XC18Action.java:568)
This line tells you to look at line 568 in XC18Action.java. So what is there? Please list it here, it's impossible to guess.

By the way, improve your programming style by ALWAYS checking the returned value. If you get a stored object from session, it might well be that it is not there, and null will be returned instead! So calling "obj=httpSession.getAttribute(...)" and then right away using it with obj.method() is suicide! You should make sure that your program also behaves well in case of errors. Not checking for errors with a simple "if (obj == null) then printError()" takes much more time than the seconds you saved by not typing this code. I bet with you if you would have typed this simple if-statement everwhere you already would have solved the problem yourself which would have taken less time than asking in forum and reading answers.
Jul 27 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.