File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes does not contain handler parameter named 'method'.  This may be caused by whitespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "does not contain handler parameter named Watch "does not contain handler parameter named New topic
Author

does not contain handler parameter named 'method'. This may be caused by whitespace

thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
Hi All,

I am testing ACTION class using JUNIT(WSAD5.1.2) ,I am getting a bug whle testing it

JUNIT is throwing an error as given below
servletunit.struts.ExceptionDuringTestError: An uncaught exception was thrown during actionExecute()
at servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCase.java:546)
at com.sbc.dcomm.ui.cart.pa.actions.PAActionTest.testSession(PAActionTest.java:73)


Console output is as given below :
ServletRedirector: init
DispatchActio E org.apache.struts.actions.DispatchAction Request[/pricingAnalysis] does not contain handler parameter named 'method'. This may be

caused by whitespace in the label text.
RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class javax.servlet.ServletException

JAVASCRIPT CODE for opening the screen :

function openPricingAnalysis()
{
var id= document.pAActionForm.id.value;
var str = 'pricingAnalysis.do?method=createPricingAnalysis&id='+id;
window.open(str,"PAT","scrollbars=yes,status=no,statusbar=no,width=800,height=600");
}

CODE FROM CONFIG FILE :
<action path="/pricingAnalysis" name="popUpForm" scope="request" type="com.sbc.dcomm.ui.cart.pa.actions.PAAction" parameter="method">
<forward name="success" path="/cart/pa/paAnalysis.jsp"/>
</action>

CODE FROM ACTION CLASS :

public Map getKeyMethodMap() {
Map map = new HashMap();
map.put("pricing.createPricingAnalysis", "createPricingAnalysis");

Could you please look into this issue and find out the solution as fast as possible.
thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
Further to above ,I am using struts framework for my application
thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
TEST CASE CLASS :

public void testPricing()
{

setConfigFile("/WEB-INF/struts-config-pa.xml");
setRequestPathInfo("/pricingAnalysis");
//setRequestPathInfo("/pricingAnalysis.do");
addRequestParameter("id","1097");
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward("success");


}
thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
Since the JavaScript function takes method as a parameter with value of method name.I have added one more line of code in the method for method parameter.

addRequestParameter("method","createPricingAnalysis");

public void testPricing()
{

setConfigFile("/WEB-INF/struts-config-pa.xml");
setRequestPathInfo("/pricingAnalysis");
addRequestParameter("method","createPricingAnalysis");
addRequestParameter("id","1097");
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward("success");


}
thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
Now the error does not say "Request[/pricingAnalysis] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text."

But it does throw following error :

JUNIT console says:
servletunit.struts.ExceptionDuringTestError: An uncaught exception was thrown during actionExecute()
at servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCase.java:546)
at com.sbc.dcomm.ui.cart.pa.actions.PAActionTest.testSession(PAActionTest.java:73)



Application (Server)Console output is as given below :
[dcomm-ui] [/dcomm-ui] [Servlet.LOG]: ServletRedirector: init

RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class javax.servlet.ServletException
thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
Solution :
I have not set method name in my test case method ,I have set it as follows :
addRequestParameter("method", "createPricingAnalysis");

Problem got solved
thomas davis
Ranch Hand

Joined: Feb 01, 2003
Posts: 207
Junit does not work with LookUpDispatchAction,it would work with DispatchAction instead.Hence you need to extend DispatchAction instead of LookUpDispatchAction
Barry Hawkins
ranger
Greenhorn

Joined: Jan 13, 2004
Posts: 8
Thomas,
It looks like you posted a solution followed by a statement that you could not find a solution and therefore had to abandon the use of LookupDispatchAction; which was it?

Thanks,


Barry Hawkins<br />All Things Computed<br />site: <a href="http://www.alltc.com" target="_blank" rel="nofollow"><br />weblog: [URL=http://www.yepthatsme.com]www.yepthatsme.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: does not contain handler parameter named 'method'. This may be caused by whitespace
 
Similar Threads
setting Handler Parmeter using c:url
How to use Cancel button in DispatchAction
Why sevlet.service() exception
Dispatch Action Issue/Exception
Struts 1.3.10 DispatchAction issue