万本电子书0元读

万本电子书0元读

顶部广告

Spring MVC: Beginner's Guide - Second Edition电子书

售       价:¥

6人正在读 | 0人评论 9.8

作       者:Amuthan Ganeshan

出  版  社:Packt Publishing

出版时间:2016-07-01

字       数:234.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Unleash the power of the latest Spring MVC 4.x to develop a complete application About This Book Work through carefully crafted exercises with detailed explanations for each step will help you understand the concepts with ease You will gain a clear understanding of the end-to-end request/response life cycle, and each logical component’s responsibility This book is packed with tips and tricks that demonstrate industry best practices on developing a Spring-MVC-based application Who This Book Is For The book is for Java developers who want to exploit Spring MVC and its features to build web applications. Some familiarity with basic servlet programming concepts would be a plus, but is not a prerequisite. What You Will Learn Familiarize yourself with the anatomy of the Spring 4.X development environment Understand web application architecture and the Spring MVC request flow Integrate bean validation and custom validation Use error handling and exception resolving Get to grips with REST-based web service development and Ajax Test your web application In Detail Spring MVC helps you build flexible and loosely coupled web applications. The Spring MVC Framework is architected and designed in such a way that every piece of logic and functionality is highly configurable. Also, Spring can integrate effortlessly with other popular web frameworks such as Struts, WebWork, Java Server Faces, and Tapestry. The book progressively teaches you to configure the Spring development environment, architecture, controllers, libraries, and more before moving on to developing a full web application. It begins with an introduction to the Spring development environment and architecture so you're familiar with the know-hows. From here, we move on to controllers, views, validations, Spring Tag libraries, and more. Finally, we integrate it all together to develop a web application. You'll also get to grips with testing applications for reliability. Style and approach This book takes a pragmatic step-by-step approach to web application development using Spring MVC, with informative screenshots and concise explanation.
目录展开

Spring MVC Beginner's Guide - Second Edition

Spring MVC Beginner's Guide - Second Edition

Credits

About the Author

About the Reviewer

www.PacktPub.com

eBooks, discount offers, and more

Why subscribe?

Preface

What this book covers

What you need for this book

Who this book is for

Sections

Time for action

What just happened?

Pop quiz

Have a go hero

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

1. Configuring a Spring Development Environment

Setting up Java

Time for action - installing JDK

Time for action - setting up environment variables

Configuring a build tool

Time for action - installing the Maven build tool

Installing a web server

Time for action - installing the Tomcat web server

Configuring a development environment

Time for action - installing Spring Tool Suite

Time for action - configuring Maven on STS

Time for action - configuring Tomcat on STS

Creating our first Spring MVC project

Time for action - creating a Spring MVC project in STS

Time for action - adding Java version properties in pom.xml

What just happened?

Spring MVC dependencies

Time for action - adding Spring jars to the project

What just happened?

A jump-start to MVC

Time for action - adding a welcome page

What just happened?

The Dispatcher servlet

Time for action - configuring the Dispatcher servlet

What just happened?

Deploying our project

Time for action - running the project

Summary

2. Spring MVC Architecture – Architecting Your Web Store

Dispatcher servlet

Time for action - examining request mapping

What just happened?

Pop quiz – request mapping

Understanding the Dispatcher servlet configuration

Time for action - examining the servlet mapping

What just happened?

Servlet mapping versus request mapping

Pop quiz - servlet mapping

Web application context

View resolvers

Time for action - understanding web application context

What just happened?

Understanding the web application context configuration

Pop quiz - web application context configuration

Model View Controller

Overview of the Spring MVC request flow

The web application architecture

The Domain layer

Time for action - creating a domain object

What just happened?

The Persistence layer

Time for action - creating a repository object

What just happened?

The Service layer

Time for action - creating a service object

What just happened?

Have a go hero - accessing the product domain object via a service

An overview of the web application architecture

Have a go hero - listing all our customers

Summary

3. Control Your Store with Controllers

The role of a Controller in Spring MVC

Defining a Controller

Time for action - adding class-level request mapping

What just happened?

Default request mapping method

Pop quiz - class level request mapping

Handler mapping

Using URI template patterns

Time for action - showing products based on category

What just happened?

Pop quiz - request path variable

Using matrix variables

Time for action - showing products based on filters

What just happened?

Understanding request parameters

Time for action - adding a product detail page

What just happened?

Pop quiz - the request parameter

Time for action - implementing a master detail View

What just happened?

Have a go hero - adding multiple filters to list products

Summary

4. Working with Spring Tag Libraries

The JavaServer Pages Standard Tag Library

Serving and processing forms

Time for action - serving and processing forms

What just happened?

Have a go hero - customer registration form

Customizing data binding

Time for action - whitelisting form fields for binding

What just happened?

Pop quiz - data binding

Externalizing text messages

Time for action - externalizing messages

What just happened?

Have a go hero - externalizing all the labels from all the pages

Summary

5. Working with View Resolver

Resolving Views

RedirectView

Time for action - examining RedirectView

What just happened?

Pop quiz - RedirectView

Flash attribute

Serving static resources

Time for action - serving static resources

What just happened?

Pop quiz - static view

Time for action - adding images to the product detail page

What just happened?

Multipart requests in action

Time for action - adding images to a product

What just happened?

Have a go hero - uploading product user manuals to the server

Using ContentNegotiatingViewResolver

Time for action - configuring ContentNegotiatingViewResolver

What just happened?

Working with HandlerExceptionResolver

Time for action - adding a ResponseStatus exception

What just happened?

Time for action - adding an exception handler

What just happened?

Summary

6. Internalize Your Store with Interceptor

Working with interceptors

Time for action - configuring an interceptor

What just happened?

Pop quiz - interceptors

LocaleChangeInterceptor - internationalization

Time for action - adding internationalization

What just happened?

Have a go hero - fully internationalize the product details page

Mapped interceptors

Time for action - mapped intercepting offer page requests

What just happened?

Summary

7. Incorporating Spring Security

Using Spring Security

Time for action - authenticating users based on roles

What just happened?

Pop quiz - Spring Security

Have a go hero - play with Spring Security

Summary

8. Validate Your Products with a Validator

Bean Validation

Time for action - adding Bean Validation support

What just happened?

Have a go hero - adding more validation in the Add new product page

Custom validation with JSR-303/Bean Validation

Time for action - adding Bean Validation support

What just happened?

Have a go hero - adding custom validation to a category

Spring validation

Time for action - adding Spring validation

What just happened?

Time for action - combining Spring validation and Bean Validation

What just happened?

Have a go hero - adding Spring validation to a product image

Summary

9. Give REST to Your Application with Ajax

Introduction to REST

Time for action - implementing RESTful web services

What just happened?

Time for action - consuming REST web services

What just happened?

Handling web services in Ajax

Time for action - consuming REST web services via Ajax

What just happened?

Summary

10. Float Your Application with Web Flow

Working with Spring Web Flow

Time for action - implementing the order processing service

What just happened?

Time for action - implementing the checkout flow

What just happened?

Understanding flow definitions

Understanding checkout flow

Pop quiz - web flow

Time for action - creating Views for every view state

What just happened?

Have a go hero - adding a decision state

Summary

11. Template with Tiles

Enhancing reusability through Apache Tiles

Time for action - creating Views for every View state

What just happened?

Pop quiz - Apache Tiles

Summary

12. Testing Your Application

Unit testing

Time for action - unit testing domain objects

What just happened?

Have a go hero - adding tests for Cart

Integration testing with the Spring Test context framework

Time for action - testing product validator

What just happened?

Time for action - testing product Controllers

What just happened?

Time for action - testing REST Controllers

What just happened?

Have a go hero - adding tests for the remaining REST methods

Summary

Thank you readers!

Appendix A. Using the Gradle Build Tool

Installing Gradle

The Gradle build script for your project

Understanding the Gradle script

Appendix B. Pop Quiz Answers

Chapter 2, Spring MVC Architecture - Architecting Your Web Store

Chapter 3, Control Your Store with Controllers

Chapter 4, Working with Spring Tag Libraries

Chapter 5, Working with View Resolver

Chapter 6, Internalize Your Store with Interceptor

Chapter 7, Incorporating Spring Security

Chapter 10, Float Your Application with Web Flow

Chapter 11, Template with Tiles

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部