If you ever got this error in your Struts 1.x application:
You are probably calling your action (which is extending DispatchAction) without passing in the appropriate parameter for the method.
Let me explain:
In you struts-config.xml file you probably have an action mapping like the following :
<action path="/search" name="searchBean" type="com.mypackage.actions.SearchAction" scope="request" validate="false" input="/createSearch.jsp" parameter="add"> <forward name="success" path="/createSearch.jsp"></forward> </action>
And in your Action class you probably defined two methods like add() and edit().
The value of the of PARAMETER_VALUE should not be the 'name' of the method you defined in your Action class (eg. add()). It should be the name of a 'parameter' which you will use to pass in the method's name:
- Change parameter="add" to parameter="function"
Wherever you are calling your Search.do action pass in the parameter like this:
localhost/StrutsApplication/Search.do?function=add localhost/StrutsApplication/Search.do //calling this will throw the error above
Another way to avoid this issue is to have a MappingDispatchAction extend your class instead of the DispatchAction. There's also a rant I found from another developer on this topic if you want to get into it further http://frustratedprogrammer.blogspot.com/2004/07/struts-121-mappingdispatchaction.html
I was going through the book Struts - The Complete Reference by James Holmes when I first ran into this problem.
Hope this helps somebody, because I remember banging my head for some time when I first ran into it a few years ago.