Spring MVC Blueprints

Book description

Design and implement real-world web-based applications using the Spring Framework 4.x specification based on technical documentation

About This Book

  • Learn all the details of implementing Spring 4.x MVC applications from basic core platform construction to advanced integration implementations
  • Gain a complete reference guide to implementing the controllers, models, views, view resolvers, and other service-related components to solve various real-world problems
  • Discover the possible optimal solutions for developers and experts to build enterprise and personal web-based applications
  • Create a Spring MVC application that has a validation process and exception handling with the HTTP status codes

Who This Book Is For

This book is for competent Spring developers who wish to understand how to develop complex yet flexible applications with Spring MVC. You must have a good knowledge of JAVA programming and be familiar with the basics of Spring.

What You Will Learn

  • Set up and configure the Spring 4.x MVC platform from ground level up using the basic Spring Framework 4.x APIs
  • Study requirements and manage solutions on file uploading transactions in Spring 4.x applications Configure, , and test Spring integration to the Hibernate, MyBatis, and JPA frameworks for database transactions
  • Properly implement exception handlers and audit trails in Spring MVC applications
  • Generate reports using JFreeChart, Google Charts, JasperReports, DynamicReports, FreeMarker, Velocity, and Spring's API known as ContentNegotiatingViewResolver
  • Configure security and flexibility by adding Captcha, Spring Security, Spring Flow, Spring Portlets, JTA to improve data management performance
  • Implement web services using Spring's RESTful implementation and other service-oriented integration plugins
  • Design and implement a Spring 4.x application using AngularJS, ExtJs, Twitter Bootstrap, and Spring Mobile for responsive web design

In Detail

Spring MVC is the ideal tool to build modern web applications on the server side. With the arrival of Spring Boot, developers can really focus on the code and deliver great value, leveraging the rich Spring ecosystem with minimal configuration.

Spring makes it simple to create RESTful applications, interact with social services, communicate with modern databases, secure your system, and make your code modular and easy to test. It is also easy to deploy the result on different cloud providers.

This book starts all the necessary topics in starting a Spring MVC-based application. Moving ahead it explains how to design model objects to handle file objects. save files into a data store and how Spring MVC behaves when an application deals with uploading and downloading files. Further it highlights form transactions and the user of Validation Framework as the tool in validating data input. It shows how to create a customer feedback system which does not require a username or password to log in. It will show you the soft side of Spring MVC where layout and presentation are given importance. Later it will discuss how to use Spring Web Flow on top of Spring MVC to create better web applications. Moving ahead, it will teach you how create an Invoice Module that receives and transport data using Web Services

By the end of the book you will be able to create efficient and flexible real-time web applications using all the frameworks in Spring MVC.

Style and approach

This book is a compendium of technical specification documents that will guide you through building an application using Spring 4.x MVC. Each chapter starts with a high-level wireframe design of the software followed by how to set up and configure different libraries and tools.

Table of contents

  1. Spring MVC Blueprints
    1. Spring MVC Blueprints
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    7. 1. Creating a Personal Web Portal (PWP)
      1. Overview of the project
      2. Technical requirements
      3. Setting-up the development environment
        1. Converting a dynamic web project to a Maven project
        2. Creating a Maven project from scratch
      4. The pom.xml file
      5. Project deployment
        1. Maven deployment process
      6. Project libraries and dependencies
      7. Overview of the Spring MVC specification
      8. The project development
        1. Configuring the DispatcherServlet
      9. Creating the Spring container
        1. Spring container configuration using XML
        2. Spring container configuration using JavaConfig
      10. Configuring the Spring container
        1. Creating the controllers
          1. The PWP controllers
        2. Using @ModelAttribute and @SessionAttributes
        3. Form domain objects
        4. The ViewResolver and view configuration
          1. Actual view pages
        5. Validating Form Data
          1. Validation using JSR 303
        6. Domain data type conversion and filtering
        7. E-mail configuration
      11. The Personal Web Portal (PWP) project
      12. Challenge yourself
      13. Summary
    8. 2. Electronic Document Management Systems (EDMS)
      1. Overview of the project
      2. Technical requirement
        1. The pom.xml
        2. The process flow
      3. The project development
        1. Configuring the DispatcherServlet
        2. Creating the Spring container
        3. Creating exception handling for multipart requests
        4. Creating the controllers
          1. Uploading a single document
          2. Uploading multiple documents
          3. Uploading single or multiple documents into the FTP server
          4. Uploading single or multiple files asynchronously
          5. Uploading documents with encryption/decryption
          6. Downloading individual documents from the file system
          7. Downloading individual documents from the FTP server
        5. The form domains
        6. The views
        7. The validators
        8. The EDMS project
      4. Challenge yourself
      5. Summary
    9. 3. Student Management Portal (SMP)
      1. An overview of the project
      2. Technical requirements
        1. Implementation A – using the Spring JDBC plugin
        2. Implementation C – using Spring and MyBatis frameworks
        3. Implementation B – using Spring and Hibernate frameworks
        4. Implementation D – using Spring, JPA and Hibernate Frameworks
      3. Software design overview
      4. Configuring the DispatcherServlet
        1. The SMP database
      5. Creating the Spring containers
        1. Implementation A – using a Spring JDBC plugin
          1. jdbc.xml
          2. dao_services.xml
          3. smp_servlet.xml
        2. Implementation B – using Spring and MyBatis frameworks
          1. jdbc.xml
          2. dao_services.xml
        3. Implementation C – using Spring and Hibernate frameworks
          1. jdbc.xml
          2. hibernate.cfg.xml
        4. Implementation D – using Spring, JPA and Hibernate frameworks
          1. jdbc.xml
          2. The persistence.xml
      6. The Data Access Object (DAO) layer
        1. Implementation A – using the Spring JDBC plugin
        2. Implementation B – using Spring and MyBatis Frameworks
        3. Implementation C – using Spring and Hibernate frameworks
        4. Implementation D – using Spring, JPA and Hibernate frameworks
      7. The service layer
        1. Implementation A – using the Spring JDBC plugin
        2. Implementation B – using Spring and MyBatis frameworks
        3. Implementation C – using Spring and Hibernate frameworks
        4. Implementation D – using Spring, JPA and Hibernate frameworks
      8. The data domain layer
        1. Implementation A – using a Spring JDBC plugin
        2. Implementation B – using Spring and MyBatis frameworks
        3. Implementation C – using Spring and Hibernate frameworks
        4. Implementation D – using Spring, JPA and Hibernate frameworks
      9. The controllers
      10. The validators and type conversion
      11. The interceptors
      12. The Aspect, Advice and PointCut
      13. The views
      14. The Student Management Portal (SMP)
      15. Challenge yourself
      16. Summary
    10. 4. Human Resource Management System (HRMS)
      1. Overview of the project
      2. Technical requirements
        1. iText 5.x
        2. Apache POI
        3. JExcelAPI
        4. JasperReports
        5. iReport 5.6.0 Visual Designer
        6. DynamicReports
        7. Freemarker Template Language (FTL)
        8. Velocity
        9. JFreeChart
        10. Google Chart
        11. ROME
        12. Software testing libraries
      3. The HRMS database
      4. Data modeling framework
      5. Integrating charts and graphs
        1. Configuring the ViewResolver
        2. The administrator's analytics
          1. The DAO and service layers
          2. The controllers
            1. Line chart
            2. XY line chart
            3. 2D bar chart
            4. 2D pie chart
            5. Other JFreeChart graphs
          3. The view pages
        3. The HR manager's analytics
          1. The DAO and service layers
          2. The controllers
            1. Line chart
            2. Bar chart
            3. Other Google Chart graphs
          3. The view pages
      6. Integrating reports
        1. PDF document generation using iText 5.x
        2. Excel sheet generation using POI
        3. Excel sheet generation using JExcelAPI
        4. Report generation using JasperReports
        5. Report generation using DynamicReports
        6. Report generation using ContentNegotiatingViewResolver
        7. Generating reports using HTML
          1. FreeMarker Template Language (FTL)
            1. tbl_header.ftl
            2. tbl_body.ftl
            3. tbl_footer.ftl
          2. Velocity
            1. header.vm
            2. footer.vm
        8. Generating news feeds
          1. RSS feeds
          2. Atom Feeds
        9. Handling exceptions
        10. Software testing
          1. Building the test class for unit testing
          2. Building the test class for integration testing
          3. Building the test class for MVC testing
      7. JVM memory management
      8. Client-side visualization
      9. The Human Resource Management System (HRMS)
      10. Challenge yourself
      11. Summary
    11. 5. Customer Feedback System (CFS)
      1. Overview of the project
      2. Technical requirements
        1. Captcha libraries
          1. reCaptcha
          2. BotDetect
          3. JCaptcha
          4. SimpleCaptcha
          5. Kaptcha
        2. SendGrid library
      3. The CFS database
      4. Data modeling framework
        1. The Captcha
        2. Posting topics and issues
          1. Adding topics
            1. The reCaptcha controller
            2. The reCaptcha View
          2. Editing topics
            1. The BotDetect controller
            2. The BotDetect view
          3. Giving feedback
            1. The Kaptcha controller
            2. The Kaptcha view
          4. Editing feedback
            1. The SimpleCaptcha controller
            2. The SimpleCaptcha view
          5. E-mail Feedback
            1. The JCaptcha controller
            2. The JCaptcha view
            3. The SendGrid service
        3. The Customer Feedback System (CSF)
        4. Challenge yourself
      5. Summary
    12. 6. Hotel Management System (HMS)
      1. Overview of the project
      2. Technical Requirements
        1. Angular JS
        2. JQuery
        3. Twitter Bootstrap
        4. Kickstrap
        5. ExtJS
        6. Thymeleaf
        7. Apache Tiles Framework
        8. SiteMesh
        9. Spring mobile
        10. Spring Roo
      3. The HMS Database
      4. User Experience (UX) design issues
        1. Adaptive web design
        2. Responsive web design
      5. Designing themes
        1. Spring MVC theme support
          1. The Spring Theme configuration
        2. Kickstrap Theme Designs
          1. Kickstrap configuration
          2. Layout design types
          3. Responsive design in Kickstrap
            1. UI components styles
            2. Theme support
        3. Twitter Bootstrap theme design
          1. Fixed grid layout design
          2. Fluid grid layout design
          3. Responsive layout design in Bootstrap
            1. UI components styles
        4. The Thymeleaf design
          1. Configuration
          2. Thymeleaf expressions
          3. Layout and theme
          4. Form handling using Thymeleaf
          5. Rendering results
          6. Internationalization support
          7. Thymeleaf layout design with fragments
      6. Creating intelligent web components
        1. AngularJS
          1. Configuration
          2. The Angular module
        2. ExtJS
          1. The application container
          2. The data model
          3. The data store
          4. The ExtJS view
          5. Controller
          6. The admin room type view
      7. Creating web layouts
        1. Apache tiles 3
          1. Configuration
          2. Creating the template file
          3. Creating the definition file
          4. Adaptive layout design in tiles
        2. SiteMesh 3
          1. Configuration
          2. Creating the decorator
          3. Adaptive layout design in SiteMesh
      8. Spring's internationalization support
        1. Configuration
        2. Creating the resource bundles
        3. The Controller
        4. The View
      9. Velocity, FreeMarker, and Rhythm
        1. Advantage and disadvantage of Velocity
        2. Advantage and disadvantage of FreeMarker
        3. Advantage and disadvantage of Rythm
      10. Spring mobile
        1. Configuration
        2. Device detection
        3. URL Mapping
        4. The Controller
        5. Spring Roo
        6. The Hotel Management System (HMS)
      11. Challenge yourself
      12. Summary
    13. 7. Online Cart System (OCS)
      1. Overview of the project
      2. Technical requirements
        1. Spring security
        2. BPMN Activiti
        3. Spring Web Flow
        4. Java Transaction API (JTA)
        5. Bitronix
        6. Spring MVC Portlet
        7. Apache Pluto
        8. JRebel
      3. The OCS database
        1. Data modeling framework
      4. The software prototypes
      5. Spring security implementation
        1. Configuring the DelegatingFilterProxy
        2. Creating the security beans
          1. The <http> tag
          2. The custom login page
          3. Non-Restricted views
          4. Restricted views
          5. Roles and permissions
            1. Types of web authorization
          6. Authentication filter processing
          7. Authentication manager
          8. The UserDetailServiceDao
          9. Password encoding
          10. Authentication failure and success handlers
          11. Session management
          12. Session timeout
          13. URL rewriting
          14. Access denied page
          15. Session fixation protection
          16. Cross-site request forgery
          17. Custom logout page
      6. Post-login transaction
      7. Transaction management using JTA
        1. JTA manager and JEE servers
        2. Tomcat and Bitronix configuration
        3. JNDI configuration
        4. Spring and JTA manager configuration
          1. Bitronix transaction manager (BTM) and JTA
        5. The persistence.xml
        6. JTA DAO transactions
        7. Tomcat 7 and BTM integration
      8. Process and navigation management
        1. Managing workflow using Activiti BPMN 2.0
          1. Database configuration
          2. Database transaction manager
          3. BPMN 2.0 process definition
          4. The process engine
          5. Built-In Activiti services
          6. The controllers
          7. The services
          8. Spring and BPMN layers
        2. Managing workflow using Spring Web Flow
          1. Web flow configuration
          2. Web flow definition
          3. View-states
          4. State transitions
            1. End states
          5. Flow actions
      9. Variable scopes
      10. Spring MVC portlet
      11. OCS as a portal
        1. Controllers
        2. Portlet modes
        3. Portlet views
      12. Application context configuration
        1. Portlet configuration
        2. Defining portlets as portal servlets
        3. Apache Pluto deployment
      13. Spring Cache
        1. Types of cache
        2. Configure caching
        3. Ehcache.xml
      14. Hot deployment using JRebel
        1. Online Cart System (OCS)
        2. Challenge yourself
      15. Summary
    14. 8. Enterprise Resource Planning (ERP)
      1. Overview of the project
      2. Technical requirement
        1. Spring Web Services
        2. JAX-WS integration
        3. JAX-RS integration
          1. Jersey RS
          2. RestEasy RS
        4. CXF integration
        5. Axis2 integration
        6. XFire integration
        7. HttpInvoker remoting
        8. Burlap and Hessian remoting
        9. Remote Method Invocation
        10. JMS
        11. Advanced Message Queuing Protocol
        12. ActiveMQ
        13. RabbitMQ
        14. Spring Social
        15. SoapUI
      3. The ERP databases
      4. Data modeling framework
        1. Multiple JNDI data sources
      5. The concept of web services
        1. Consumer-producer relationship
        2. The Spring REST architecture
        3. The Spring-WS Framework
          1. Contract-First versus Contract-Last strategies
          2. Web service generation
          3. Client code generation
        4. JAX-WS
          1. Web service generation (document-based)
          2. Client code generation (document-based)
          3. Web service generation (RPC based)
          4. Client code generation (RPC based)
        5. JAX-RS (RESTful) web services
          1. Web service generation (Jersey)
            1. Media type problem
          2. Web service generation (RestEasy)
        6. Axis2 web service implementation
          1. Web service generation
          2. Web client generation
        7. CXF web service implementation
          1. Web service generation
        8. XFire web service implementation
          1. Web service generation
          2. Web client generation
        9. HttpInvoker, Burlap, and Hessian remoting
          1. Remoting through HttpInvoker
          2. Accessing HttpInvoker services
          3. Remoting through Burlap
          4. Accessing Burlap services
          5. Remoting through Hessian
          6. Accessing Hessian services
          7. Spring containers for remoting
        10. Remote Method Invocation
        11. JMS using ApacheMQ
        12. AMQP using RabbitMQ
        13. Spring Social
        14. The ERP
        15. Challenge yourself
      6. Summary
    15. 9. Bus Ticketing System (BTS)
      1. Overview of the project
      2. Technical requirements
        1. AJAX
        2. jQuery
        3. Prototype framework
        4. Dojo
        5. RestEasy AJAX
        6. DWR
        7. WebSocket
      3. jQGrid
      4. The BTS database
      5. Data modeling framework
      6. AJAX and Spring integration
        1. Custom AJAX development
        2. jQuery AJAX
        3. Prototype AJAX
        4. Dojo AJAX
        5. RestEasy JSAPI
        6. Direct web remoting
        7. WebSocket
        8. jQGrid
        9. Google Chart visualization
        10. The Bus Ticketing System (BTS)
        11. Challenge yourself
      7. Summary
    16. 10. Social Task Management System (STMS)
      1. Overview of the project
      2. Technical requirements
        1. Spring Data JPA
        2. Spring Data MongoDB
        3. Spring Data REST
        4. Spring Data Solr
        5. Neo4J
        6. Spring integration
      3. Collaborative data analysis concept
        1. Database configuration
          1. Spring Data JPA configuration
          2. Spring Data MongoDB configuration
        2. Database search techniques
          1. Document-based and full-text search
            1. Configuring the Solr server
            2. The Spring-Solr integration
          2. The Spring-Neo4J integration
            1. Configuring the Neo4J graph search server
            2. Spring-Neo4J integration
            3. Integration pitfalls
        3. Codeless REST implementation
        4. Enterprise integration architecture
        5. Social task management system 
        6. Challenge yourself
      4. Summary

Product information

  • Title: Spring MVC Blueprints
  • Author(s): Sherwin John Calleja Tragura
  • Release date: July 2016
  • Publisher(s): Packt Publishing
  • ISBN: 9781785888274