I am building a small Application of Spring,Spring MVC & Hibernate by taking reference from
http://www.vaannila.com/spring/spring-hibernate-integration-1.html
There are two methods defined:
-> saveUser,listUser on UserDAOImpl class
Also, two methods (add,list) are on UserController.
My Question is: how the application knows which method would be invoked?
Because the MultiActionController uses a InternalPathMethodNameResolver by default. Tne controller is mapped to
/user/*.htm, and the form posts to /user/add.htm. So the controller is invoked, and the method name resolver calls the add method because the path ends withadd.htm.If you plan to use Spring MVC for a new project, I would advise to read the spring reference documentation, because the MultiActionController is not the preferred way to have multiple actions in a single controller anymore.