Spring MVC Blueprints
上QQ阅读APP看书,第一时间看更新

What this book covers

Chapter 1, Creating a Personal Web Portal (PWP), highlights the Inverse of Control (IoC) and Dependency Injection (DI) design patterns of the Spring 4.x MVC architecture. All classes and interfaces of Spring 4.x specification, which create the types of controllers, models, and views, including their validators and property editors, are explained by implementing a Personal Web Portal (PWP) prototype that uses only @ModelAttribute and @SessionAttributes to transport and store data through Spring's common page navigations and redirections. Spring MVC applications, Maven deployment and core coding standards are also taken into consideration during prototype development.

Chapter 2, Electronic Document Management Systems (EDMS), focuses on how Spring can handle file upload and download in preparation for some custom document or record management portal development. Through the implementation of a prototype, this chapter discusses how to use Spring’s MultipartFile interface together with HttpServletRequest and MultipartHttpServletRequest for processing documents of any rendition type, with or without encryption/decryption. Also, part of the chapter covers how clients can upload or download file to and from FTP server and how Spring container manage file repository transactions using client-side components such as AJAX.

Chapter 3, Student Management Portal (SMP), showcases the data modeling part of Spring through the use of standard JDBC interfaces and popular object-relational mapping (ORM) frameworks such as Hibernate 4.x  and MyBatis 3.x. Moreover, it also includes JPA configuration to add data persistency to the project. Although this chapter focuses heavily on container configuration, it manages to tackle how to generate data model entities through Spring annotations and map form models to views through Spring's standard tag libraries. On the side, it also demonstrates how to attach auditing functionality through the use of logging framework Log4J and/or Logback.

Chapter 4, Human Resource Management System (HRMS), focuses on writing applications that deal with voluminous data presentation and automated reports with some business intelligence, like that of the HRMS. The prototype provides a mechanism to generate .pdf, .doc, and .xls reports through ContentNegotiatingViewResolver and other related view APIs. For common plugins, HRMS has a functionality that generates those documents through the use of POI and iText libraries. For colorful graphs and charts, this chapter includes GoogleChart and JFreeChart as the main libraries in HRMS for generating data visualizations from hardcoded or database records. Popular enterprise report generation tools such as JasperReports and DynamicReports are also part of the app. On the side, this chapter manages to include exception handling and unit testing in Spring.

Chapter 5, Customer Feedback System (CFS), provides the mechanism to protect application such as CFS from spammers and bots. Applications such as forums or survey portals mainly implement CAPTCHA to prevent unwanted or automated spamming. In this chapter, Spring uses some of the popular CAPTCHA solutions, namely reCaptcha, JCaptcha, SimpleCaptcha, Kaptcha, and BotDetect, to enable protection for CFS. On the side, CFS has a Contact Us functionality that uses SendGrid to manage, secure, and monitor suspicious inbound and outbound e-mail traffic through its email server.

Chapter 6, Hotel Management System (HMS), explains how to build adaptive and responsive web pages in applications that use the Spring framework.  The chapter offers different solutions on how to make applications look friendly on mobile, tablets, and desktops. For intelligent themes, this chapter highlights ThemeResolver to play around with static resources (for example, CSS, JavaScript, and images) of the pages. On creating Single Page Applications (SPA), the chapter discusses using JavaScript objects in ExtJS and AngularJS to process data from the Spring MVC layers. On the other hand, the responsiveness of the HMS pages is discussed further using Twitter Bootstrap and Kickstrap, together with the adaptive tile templates created by Sitemesh and Tiles Framework. Spring integration, Thymeleaf and Spring Mobile is also included in this chapter.

Chapter 7, Online Cart System (OCS), emphasizes workflows and security by creating a prototype of one of the market's popular solution, the e-commerce application.  Aside from custom navigations shown in the previous chapters, this chapter illustrates other smart and advanced solutions to implement formalized business processes through Activiti BPMN 2.0, Spring Web Flow, and Portlet MVC Framework. This chapter also manages to get into the details of Spring Security to provide a comprehensive security solution for any Spring application.

Chapter 8, Enterprise Resource Planning (ERP), helps create software that builds business processes through remote transactions web services just such as an ERP system. This chapter provides a skeleton for how to design interconnected Spring projects through RESTful and SOAP-based services. To start with, the projects have a simple @RestController implementation of the REST web service and we proceed to expand on some advanced integrations with JAX-WS, JAX-RS, Spring WS, CXF, Axis2, and XFire. On the other hand, the ERP successfully integrates Hessian, Burlap, and HttpInvoker to implement remote services between modules. AMQP and JMS have been integrated into this chapter to implement a thin layer of messaging protocol for event handling. This chapter also has side discussions on the 0Auth protocol for adding features on login authentication through Facebook and Twitter Spring Social modules.

Chapter 9, Bus Ticketing Management System (BTS), implements browser-based applications using the Spring MVC specification. Not heavily loaded with Spring components, this chapter is streamlined to use JQuery, Prototype, DWR, and Dojo for data processing and presentation to some applications with a wide range of users, such as BTS. The conversion of data to JSON and XML is also highlighted through the use of the JAXB marshaller for the former and JSON mapping for the latter. Moreover, the chapter promotes JQGrid for intelligent tabular data presentation and GoogleChart JavaScript APIs for data visualization.

Chapter 10, Social Task Management System (STMS), finalizes the extensibility of Spring through the use of Spring Data and Spring Integration modules. This chapter proves that the functional specification of an application can make use of the core and advanced Spring components with fewer libraries. Compacted into one module, this chapter has two applications that have the data repository and service layers with lesser code and fewer processes webbed together using Spring Integration’s channels, service activators, bridges, splitters, and aggregators. Moreover, it illustrates the process to produce web services using inbound gateways and consume RESTful and SOAP-based services using the outbound gateways of Spring Integration.