File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Problem in calling a method in my Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in calling a method in my Action" Watch "Problem in calling a method in my Action" New topic
Author

Problem in calling a method in my Action

Ramesh Jothimani
Ranch Hand

Joined: May 05, 2011
Posts: 70

I have a method named handleReportUpdate() in my ReportsConfigurationAction.java . When I try to call handleReportUpdate , I am getting error as ,

java.lang.NoSuchMethodException: com.tcs.admin.actions.ReportsConfigurationAction.handleReportUpdate(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
at java.lang.Class.getMethod(Class.java:1605)
at org.apache.struts.actions.DispatchAction.getMethod(DispatchAction.java:334)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:266)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

The Method is as follows :




The entry in struts-config file is as follows :



I am calling the handleReportUpdate() as follows :

/reportsconfig.do?parameter=handleReportUpdate



Please help me to solve the issue . Thanks !

Vivek Kanodia
Greenhorn

Joined: Apr 27, 2012
Posts: 6
You are probably getting the Exception because the method expected is
public ActionForward execute(ActionMapping mapping,
ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception. Just try changing the method name and it might solve your problem.
Ramesh Jothimani
Ranch Hand

Joined: May 05, 2011
Posts: 70

I have changed



to



So the method handleReportUpdate() requires ActionForm in the parameter. I have passed ActionForm in function parameter & it is working fine now.

Thanks !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in calling a method in my Action