2011年4月17日 星期日

[Introduction] SpringMVC

* Spring MVC
  • Is essentially a request dispatcher framework, with a Servlet API variant and Portlet API variant.
  • As providing foundational facilities and conveniences on top of the Servlet/Portlet container, ex:
    • Flexible request mappings: separation between controller processing and view rendering phase
    • Data binding: basic JSP tag libraries that complement the JSTL, etc.
    • The building blocks of sophisticated HTTP request processing.

* The class is annotated with the @Controller stereotype. This indicates that its methods should be scanned for request mappings.

* @RequestMapping
  • The actual request mappings are expressed through this at the method level.
  • Each of those mappings binds to a specific HTTP path within the containing DispatcherServlet.
  • Allows for specifying HTTP request methods (e.g. method = RequestMapping.GET) or specific request parameters (e.g. params = "action=save"), all narrowing the type-level mapping for specific methods. Alternatively,

* Reference
- Chapter 13. Web MVC framework
- Annotated Web MVC Controllers in Spring 2.5

沒有留言:

張貼留言