Spring MVC

4,701 views

Published on

Introduction to Spring MVC

Published in: Technology, Education
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,701
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
0
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide
  • Spring MVC

    1. 1. Spring MVC Yet Another Web Framework
    2. 2. MVC for Java Web Applications <ul><ul><li>Model = Java POJO </li></ul></ul><ul><ul><li>View = JSP Pages </li></ul></ul><ul><ul><li>Controller = Java Servlet </li></ul></ul>
    3. 3. Spring's MVC Approach <ul><ul><li>Model = Java Map </li></ul></ul><ul><ul><li>View = Pluggable view technology (JSP, tiles, velocity, etc) </li></ul></ul><ul><ul><li>Controller = Spring controller classes </li></ul></ul><ul><li>  </li></ul><ul><li>  </li></ul>
    4. 4. The HTTP Request
    5. 5. Spring MVC Overview <ul><ul><li>All calls go through DispatcherServlet </li></ul></ul><ul><ul><li>Spring beans configured in context XML file </li></ul></ul>
    6. 6. Handling Forms <ul><ul><li>Controllers - displays the form or processes the form submit (by detecting GET/POST) </li></ul></ul><ul><ul><li>Command - Java class that represents the form data </li></ul></ul><ul><ul><li>Validators - validates a class, usually your Command class </li></ul></ul><ul><li>  </li></ul><ul><li>Logical breakdown of form processing: </li></ul><ul><ul><li>formBackingObject() </li></ul></ul><ul><ul><li>onBindNewForm() </li></ul></ul><ul><ul><li>onBind() </li></ul></ul><ul><ul><li>onBindAndValidate() </li></ul></ul><ul><ul><li>onSubmit() </li></ul></ul>
    7. 7. Bonus features <ul><ul><li>Interceptors - do something before handing off to controller </li></ul></ul><ul><ul><li>HandlerExceptionResolvers - handle exceptions thrown from controllers </li></ul></ul><ul><ul><li>AbstractWizardFormController - support simple workflow pages (session-backed forms - think shopping cart check out) </li></ul></ul>
    8. 8. Demo <ul><li>  </li></ul>
    9. 9. References <ul><ul><li>http://static.springframework.org/spring/docs/2.5.x/api/ </li></ul></ul><ul><ul><li>http://static.springframework.org/spring/docs/2.5.x/reference/spring-web.html </li></ul></ul>

    ×