Results 1 to 6 of 6

Thread: Problem with @RequestMapping("/*.do")

  1. #1
    Join Date
    Dec 2004
    Posts
    7

    Default Problem with @RequestMapping("/*.do")

    Hi

    I've have a simple HTML Form with an action set to addEmployeeAnno.do.

    In my Controller marked with
    @Controller
    @RequestMapping("/*.do")

    I have a method called public String addEmployeeAnno(@ModelAttribute EmployeeBean employee)

    When I try to run this i get this error:

    javax.servlet.ServletException: No adapter for handler [com.in2objects.springapp.web.spring.WebAppControll erAnnoteted@c60b6b]: Does your handler implement a supported interface like Controller?
    at org.springframework.web.servlet.DispatcherServlet. getHandlerAdapter(DispatcherServlet.java:1086)
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:873)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:808)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:431)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:820)
    at weblogic.servlet.internal.StubSecurityHelper$Servl etServiceAction.run(StubSecurityHelper.java:226)
    at weblogic.servlet.internal.StubSecurityHelper.invok eServlet(StubSecurityHelper.java:124)
    at weblogic.servlet.internal.ServletStubImpl.execute( ServletStubImpl.java:283)
    at weblogic.servlet.internal.ServletStubImpl.execute( ServletStubImpl.java:175)
    at weblogic.servlet.internal.WebAppServletContext$Ser vletInvocationAction.run(WebAppServletContext.java :3370)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Un known Source)
    at weblogic.servlet.internal.WebAppServletContext.sec uredExecute(WebAppServletContext.java:2117)
    at weblogic.servlet.internal.WebAppServletContext.exe cute(WebAppServletContext.java:2023)
    at weblogic.servlet.internal.ServletRequestImpl.run(S ervletRequestImpl.java:1359)
    at weblogic.work.ExecuteThread.execute(ExecuteThread. java:200)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java :172)

    What I'm I doing wrong?

    If I use the @RequestMapping on the method level it works but not on the Controller level. Do I need to set a AnnotationMethodHandlerAdapter (methodNameResolver) in my spring.xml to get this to work?

    Many Thanks

    Thomas

  2. #2
    Join Date
    Dec 2007
    Location
    Kerala, India
    Posts
    66

    Default

    i am also new guy so just try like this
    @RequestMapping(method = RequestMethod.GET) for handling get method
    and @RequestMapping(method = RequestMethod.POST) for post above hadling metods
    aslo like feed back

  3. #3
    Join Date
    Dec 2004
    Posts
    7

    Default

    @RequestMapping(method = RequestMethod.POST)

    works!

    But I hoped that I could do without the @RequestMapping on the methods. That Spring would figure out this out.

    Thanks

    Thomas

  4. #4
    Join Date
    Dec 2007
    Location
    Kerala, India
    Posts
    66

    Default

    to do that you must implemet some interfaces or extent some classes
    and you must selcect one that handle your need
    for that it is good to read spring documentation

  5. #5
    Join Date
    Dec 2004
    Posts
    7

    Default

    I'll will try to test the MethodNameResolver method on the AnnotationMethodHandlerAdapter to see if that works.

    Have a look at this blog:

    http://blogs.warwick.ac.uk/chrismay/entry/spring_25_web

    Best Regards
    Thomas

  6. #6
    Join Date
    Dec 2004
    Posts
    7

    Default

    If I put an "empty" @RequestMapping on the method it also works. But I still think it would be nice if Spring by default would find and map my methods in the Controller.

    /Thomas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •