• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Design & Development of Web Applications using SpringMVC
 

Design & Development of Web Applications using SpringMVC

on

  • 4,841 views

Design & Development of Web Applications using SpringMVC

Design & Development of Web Applications using SpringMVC

Statistics

Views

Total Views
4,841
Views on SlideShare
4,836
Embed Views
5

Actions

Likes
3
Downloads
1
Comments
0

1 Embed 5

http://www.linkedin.com 5

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC Presentation Transcript

    • Design & Development of Web Applications using Spring MVC by Naresh Chintalcheru
    • Spring MVC Another Web MVC Framework?
    • Spring MVC Another Web MVC Framework? After learning Struts, JSF, DDUI ……. …………….. now Spring MVC ?
    • Spring MVC ● Benefit of using a Web Framework ● Removes the need of boilerplate code ● Gather HTTP Request Parameters ● Validation & Conversions ● Update the Model ● Standard code level design for multiple applications in an enterprise ● Navigation Flow ● Validations
    • Spring MVC ● Benefit of using a Web Framework ● No Web Application Component Design ● Use Web Framework as Design Templates and plugin the View, Model and Controllers
    • Spring MVC ● Benefit of using a Web Framework ● Speed up the development
    • Spring MVC Web MVC Frameworks ● Struts ● JSF ● Wicket ● DDUI ● Spring MVC
    • Spring MVC Presentation Layer Frameworks ● Web MVC Framework ● Template Framework ● View Technologies ● UI Widget Framework
    • Spring MVC Template Frameworks ● Tiles ● Facelets ● SiteMesh View Technologies ● JSP ● XHTML ● XSLT UI Widget Frameworks ● JQuery ● DOJO ● SFX
    • Spring MVC Why Spring MVC Framework?
    • Spring MVC Spring MVC is a action-based or request-based framework similar to Struts. JSF is a component-based framework.
    • Spring MVC
    • Spring MVC
    • Spring MVC Spring MVC vs JSF ● JSF is part of JEE Specification ● JSF is based on component architecture and has learning curve ● Limited HTTP GET method support in JSF ● REST Web Services Support in Spring MVC.
    • Spring MVC Spring MVC vs Struts ● Struts forces concrete Inheritance of Action/ActionForm, taking away single shot of Inheritance in Java. ● Spring MVC based on Interfaces and Annotations. ● Spring MVC is truly view-agnostic. Many options in View Technologies. ● Use Spring IoC Container from Presentation Tier to Integration Tier.
    • Spring MVC Spring MVC is only one module in the Spring Framework
    • Spring Framework Fundamentals
    • Spring Framework Fundamentals
    • Spring Framework Fundamentals What is Spring Framework ? ● Spring Framework is ….. ● Open Source Meta Framework ● Provides frameworks and container ● Simplify the development
    • Spring Framework Fundamentals Spring framework is a Layered Architecture Choose the modules needed and eliminate other modules All modules are built on the top of its core container
    • Spring Framework Benefits: ● Light Weight ● Promotes good OO design ● Container Agnostic Framework : Insulates the application from its hosting container.
    • Spring Framework Fundamentals Spring Has Two Web Frameworks ● Spring MVC ● Spring Web Flow
    • Spring Framework Fundamentals Spring Framework Web Flow ● Secondary Page Flow logic framework ● Can be used with Spring MVC, JSF and Struts.
    • Spring Framework Fundamentals Spring MVC Request Flow ….
    • Spring MVC Spring MVC
    • Spring MVC Spring MVC
    • Spring MVC Front Controller Design Pattern: ● DispatcherServlet is the Front Controller handles Client Requests. ● ActionServlet in Struts ● FacesServlet in JSF ● AppServlet in DDUI
    • Spring MVC Controller Design Pattern in MVC: ● Controllers are components that are being called by the Dispatcher Servlet for performing page level logic and delegate to Service Objects. ● Action Classes in Struts ● Managed Beans & Backed Beans in JSF ● PageProcessor in DDUI
    • Spring MVC View Resolver & Navigation Logic: ● Resolves view names to views. Resolves navigation logic from spring-mvc.xml ● Struts-config.xml in Struts ● Jsf-config.xml in JSF
    • Spring MVC Developing App using Spring MVC: ● Step 1: web.xml : Front Controller <web-app version="2.4"> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>*.*</url-pattern> </servlet-mapping> </web-app>
    • Spring MVC Developing App using Spring MVC: ● Step 2: web.xml : ApplicationContext <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring-mvc.xml</param-value> </context-param>
    • Spring MVC Developing App using Spring MVC: ● Step 3: spring-mvc.xml : Component Scan <beans> <context:component-scan base-package=“com.sf.web"/> </beans>
    • Spring MVC Developing App using Spring MVC: ● Step 4: Controller Classes @Controller public class EmployeeController { @Autowired private final EmployeeSO employeeSO; @RequestMapping("/emplist") public String empHandler(Model model) { List empList = employeeSO.getAllEmp(); model.addAttribute(“empList”, empList); return “ListEmpPage” ; } }
    • Spring MVC Bean Validation Framework JSR-303: public class Employee { @NotNull @Pattern(regexp = "[a-z-A-Z]*") private String firstName; @Size(min=2, max=15) private String lastName; @Past private Date birthDate; @Email (message=“Invalid Email “) private String email;
    • Spring MVC REST Web Services: http://localhost:8080/SpringMVC/employee/John @Controller @RequestMapping("/employee") public class EmployeeController { @RequestMapping( value="/{name}“ ) public String getEmp(@PathVariable String name, ModelMap model) { model.addAttribute(“emp", name); return “EmpListPage"; } }
    • Spring MVC Question & Answers