-
Dec 27th, 2007, 11:48 AM
#1
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
-
Dec 28th, 2007, 05:44 AM
#2
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
-
Dec 28th, 2007, 07:57 AM
#3
@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
-
Dec 28th, 2007, 09:54 PM
#4
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
-
Dec 29th, 2007, 02:14 AM
#5
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
-
Dec 29th, 2007, 11:34 AM
#6
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
-
Forum Rules