firhmily
firhmily
2011-08-24 12:59
浏览 173
已采纳

求解:关于struts1+spring+ibatis整合的问题

struts1+spring+ibatis整合,都配置好了,可是老报错说找不到方法

struts1的配置
[code="java"]
type="org.springframework.web.struts.DelegatingActionProxy" scope="request"
parameter="cmd">





[/code]

是spring的配置

[code="java"]

<bean name="/TimePlan"
    class="com.talkweb.analyseInfo.web.struts.action.TimePlanAction">
        <property name="timePlan">
        <ref bean="proxytimePlanService"/>
    </property>
</bean>

[/code]

action的代码
[code="java"]

public class TimePlanAction extends DispatchAction {

private ITimePlan timePlan;

private TimePlanBean timePlanBean;

protected ActionForward showTimePlan(ActionMapping mapping,
        ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    System.out.println("---------- show -------------");
    List list = timePlan.getAllTimePlansYear();
    if (list != null) {
        HttpSession session = request.getSession();
        session.setAttribute("timePlanList", list);
        return mapping.findForward("show");
    } else
        return mapping.findForward("error");
}

}
[/code]

web.xml里面配置的是.do结尾的访问action
使用这个访问地址:
http://localhost:8080/analyseInfo/TimePlan.do?cmd=showTimePlan

错误代码:
[code="java"]
java.lang.NoSuchMethodException: com.talkweb.analyseInfo.web.struts.action.TimePlanAction.showTimePlan(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:347)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:255)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
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.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:127)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
[/code]

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • myali88
    myali88 2011-08-24 13:46
    已采纳

    [code="java"]
    java.lang.NoSuchMethodException: com.talkweb.analyseInfo.web.struts.action.TimePlanAction.showTimePlan(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

    [/code]
    可能是你的Action里的方法签名和它要求的不一致。好好检查一下,或者把struts的Action类里面的execute的方法拷贝过来,再改名字。

    点赞 评论

相关推荐