Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

controller with Spring annotation ?

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write a controller with Spring annotation.

Below is the coding, when server starts up, I can see output in console " org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping - Mapped URL path [/user.do] onto handler [com.web.UserController@9e8c34]"

then, when I type "http://localhost:8080/SpringAnotation/user.do?cmd=showUserForm", it will not invoke that method, no any debug information shown in console.

Do I need any other setup in dispatcher-servlet.xml except "context:component-scan" ?

Thanks.

 
Rendi Artha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what did you realy want to do?
you could use @RequestParam for binding request parameters to method parameters.

Rgds,
Rendi
 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rendi Artawijaya wrote:what did you realy want to do?
you could use @RequestParam for binding request parameters to method parameters.


I need migrate Spring 2.0 to 3, the old one is multiaction controller, defined as below.


Here, the 'cmd' is paramName, so when I type "/case.do?cmd=saveNew", it should go to that method. Now I need use Annotation to achieve this.

Thanks.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic