DispatchAction提交问题

一、问题:在struts1.2提交form表单时,报错!

 

1、jsp中功能描述:

 

<form action="login.do?method=updata">

.......

    <input type="submit" value="更新"/>

</form>

 

2、struts-config.xml中描述:

 

<action path="/login"

  name="personForm"

  scope="request"

  parameter="method"

  type="org.springframework.web.struts.DelegatingActionProxy"

  >

 

3、MyEclipse控制台异常描述:

 

2009-9-17 9:31:42 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet action threw exception

javax.servlet.ServletException: Request[/login] does not contain handler parameter named 'method'.  This may be caused by whitespace in the label text.

at org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:222)

at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:256)

at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)

at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)

at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)

at java.lang.Thread.run(Thread.java:595)

 

二、解决方案:

 

    确保配置无误后,在form提交时必须以“POST”方式提交,所以将提交方式改为:

 

    <form action="login.do?method=updata" method="post">

 

 这样问题就得以解决。

 

 

三、附加:根据异常信息:javax.servlet.ServletException: Request[/login] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text.

此句翻译:提交参数那里可能某个标签有空格。

 

1、所以如果是以下这种情况也能发生同样错误信息:

 

<form action="login.do?(空格)method=updata" method="post">

<form action="login.do?method(空格)=updata" method="post">

//注意:(空格)表示一个空格,这样就报上边的异常了。(估计是该异常信息就描述的是此种情况)

 

2、其次:如果是<form action="(空格)login.do?method=updata" method="post">

          或

         <form action="login.do?method=updata(空格)" method="post">都没问题。

 

3、如果这样<form action="login.do?method=(空格)updata" method="post">

那么就会报:java.lang.NoSuchMethodException: com.summer.actions.PersonAction. updata(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

//找不到方法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值