461 Pages · 16.88 mb ·
Web Design
- Contents at a Glance (Page 3) - Contents (Page 452) - About the Author (Page 460) - About the Technical Reviewer (Page 461) - Introduction (Page 4) - Chapter 1: Introducing Java Web Development (Page 7) - JVM Languages (Page 8) - Languages Designed for the JVM (Page 8) - Languages Ported to the JVM (Page 9) - Java EE (Page 10) - The Java EE Platform (Page 11) - The Client Tier (Page 12) - The Web Tier (Page 12) - Web Layer (Page 15) - Service Layer (Page 16) - Data Access Layer (Page 16) - Java Web Frameworks (Page 16) - Getting Started with Java (Page 17) - Setting Up the Development Environment (Page 18) - Creating and Running Your First Java Application (Page 18) - Running Your Java Application (Page 19) - Developing Java Applications with an IDE (Page 19) - Creating Your First Project in the IDE (Page 19) - Creating the Application (Page 21) - Javadoc Comments (Page 22) - The Bookstore Application (Page 25) - Data Model for the Bookstore Application (Page 26) - Data Access Layer for the Bookstore Application (Page 31) - Client for the Data Access Layer (Page 39) - Trends and Technologies in the Java Web Landscape (Page 41) - Responsive Web Applications (Page 41) - Single-Page Web Application (SPA) (Page 44) - Real-Time Web Application (Page 44) - Reactive Web Application (Page 45) - Mashups and Web Services (Page 45) - JavaScript Object Notation (Page 45) - Simple Object Access Protocol (Page 46) - Representational State Transfer (Page 46) - Semantic Web (Web 3.0) (Page 47) - Summary (Page 47) - Chapter 2: Building Web Applications Using Servlets and JSP (Page 48) - Servlets (Page 50) - Your First Web Application Using a Servlet (Page 52) - Request Flow for the HelloWorld Servlet (Page 62) - HTTP Request Message (Page 62) - Examining the Request (Page 64) - Locating the Servlet (Page 64) - The Life-Cycle Methods (Page 65) - GenericServlet (Page 66) - HttpServlet (Page 66) - HelloWorld Servlet (Page 66) - init( ) (Page 66) - service( ) (Page 67) - destroy( ) (Page 67) - ServletContext and ServletConfig (Page 67) - Initialization Parameters (Page 68) - Context-Init Parameters (Page 69) - RequestDispatcher (Page 69) - Getting a RequestDispatcher from a ServletRequest (Page 70) - Getting a RequestDispatcher from a ServletContext (Page 70) - Filters (Page 70) - Configuring Servlet via Annotations (Page 72) - Java Server Pages (Page 76) - Your First Web Application Using JSP (Page 76) - JSP Basics (Page 80) - JSP Directives (Page 81) - Page Directive (Page 81) - Include Directive (Page 82) - Taglib Directive (Page 83) - Declarations (Page 83) - Expressions (Page 84) - Scriptlets (Page 84) - Implicit Objects (Page 84) - application (Page 85) - config (Page 86) - exception (Page 86) - out (Page 86) - page (Page 86) - pageContext (Page 86) - request (Page 86) - response (Page 86) - session (Page 86) - Standard Actions (Page 87) - The Action (Page 87) - The Action (Page 88) - The , , and Actions (Page 89) - The MVC Pattern (Page 91) - Bookstore Application (Page 92) - Home Page (Page 93) - Step 1: Locating the Servlet from the Request (Page 95) - Step 2 and Step 3: Accessing DB via DAO to Get the Categories from the Database and Setting the Categories in the Model (Page 96) - Step 4: Dispatching to the View (Page 96) - Step 5: Accessing the Model from the View (Page 98) - Step 6: Sending the Response (Page 99) - Listing All the Books (Page 99) - Searching the Books by Category (Page 101) - Searching the Books by Keyword (Page 103) - Summary (Page 108) - Chapter 3: Best Practices in Java EE Web Development (Page 109) - Best-Practice Solutions: Using EL and JSTL (Page 111) - Expression Language (Page 113) - Literals (Page 114) - Reserved Words (Page 114) - EL Operators (Page 114) - Arithmetic Operators (Page 114) - Relational Operators (Page 115) - Logical Operators (Page 117) - Using EL (Page 118) - The [ ] and . Operators (Page 121) - Inside the Brackets (Page 122) - EL Implicit Objects (Page 127) - Using EL Implicit Objects (Page 128) - Accessing Request Parameters (Page 128) - Accessing the Header (Page 128) - Accessing Cookie (Page 129) - Accessing a Scoped Attribute (Page 129) - EL Functions (Page 130) - JSTL (Page 132) - The Core Tag Library (Page 133) - General-Purpose Actions (Page 134) - The Action (Page 134) - The Action (Page 136) - Setting the Value of a Scoped Variable in Any JSP Scope (Page 136) - Setting the Property of a Specified Target Object (Page 137) - The Action (Page 138) - The Action (Page 138) - Conditionals (Page 139) - The Action (Page 139) - The , , and Actions (Page 140) - Looping and Iteration (Page 142) - The Action (Page 142) - The Action (Page 144) - URL-Related Actions (Page 145) - The Action (Page 145) - The Action (Page 147) - The Action (Page 148) - The Action (Page 149) - Best-Practice Solutions: Using Patterns (Page 150) - Intercepting Filter (Page 151) - Front Controller (Page 153) - Controller (Page 154) - Dispatcher (Page 154) - View (Page 154) - View Helper (Page 155) - View (Page 155) - View Helper (Page 155) - Composite View (Page 156) - Dispatcher View (Page 157) - Front Controller (Page 158) - Dispatcher (Page 158) - Helper (Page 158) - View (Page 158) - Service to Worker (Page 159) - Front Controller (Page 160) - Dispatcher (Page 160) - Helper (Page 160) - Java Web Frameworks (Page 162) - Why Use a Framework? (Page 163) - Summary (Page 164) - Chapter 4: Building a Web Application Using Struts 2 (Page 165) - Struts 2 Framework Overview (Page 165) - Action (Page 168) - Action Interface (Page 169) - ActionSupport Class (Page 170) - Interceptors (Page 171) - ValueStack and OGNL (Page 172) - ResultType and Result (Page 172) - Struts 2 Tags (Page 173) - Getting Started with Struts 2 (Page 173) - Bookstore Web Application (Page 187) - The Login Functionality (Page 187) - Developing Templates (Page 192) - Integrating the Data Access Layer (Page 199) - Login Using Database (Page 201) - Displaying Categories Retrieved from the Database (Page 202) - Listing Books by Category (Page 203) - Summary (Page 205) - Chapter 5: Building Java Web Applications with Spring Web MVC (Page 206) - Spring Framework Overview (Page 207) - AOP and Instrumentation (Page 207) - Core Container (Page 207) - Data Access/Integration (Page 208) - Test (Page 208) - Web (Page 208) - Spring Framework Fundamentals (Page 209) - Application Context (Page 214) - Key Objectives of the Spring Framework (Page 215) - Dealing with Tight Coupling Using Dependency Injection (Page 215) - Addressing Cross-Cutting Concerns Using AOP (Page 220) - Removing Boilerplate Code Using Templates (Page 224) - Building Web Application with Spring Web MVC (Page 230) - Spring Web MVC Architecture (Page 230) - WebApplicationContext (Page 231) - The DispatcherServlet (Page 233) - Spring MVC Components (Page 234) - Getting Started with a Spring Web MVC Application (Page 235) - Implementing Spring Web MVC in the Bookstore Application (Page 248) - Working with Forms Using Annotations (Page 254) - Annotations-Based Validation (Page 260) - Configuring the Validator (Page 263) - Summary (Page 264) - Chapter 6: Component-Based Web Development Using JSF 2 (Page 265) - The Architecture of JSF (Page 266) - FacesServlet (Page 266) - Managed Bean (Page 266) - VDL (Page 267) - JSF EL (Page 267) - JSF Tag Library (Page 267) - UI Component (Page 268) - Renderer (Page 268) - Converter and Validator (Page 269) - Events and Event Listeners (Page 269) - Getting Started with JSF (Page 269) - Life Cycle of a JSF Application (Page 279) - Phase 1: Restore View (Page 280) - Phase 2: Apply Request Values (Page 280) - Phase 3: Process Validation (Page 280) - Phase 4: Update Model (Page 280) - Phase 5: Invoke Application (Page 281) - Phase 6: Render Response (Page 281) - Managed Beans (Page 283) - Facelets (Page 284) - Templating with Facelets (Page 284) - ui:composition (Page 284) - ui:decorate (Page 285) - ui:define (Page 285) - ui:insert (Page 285) - ui:include (Page 285) - ui:param (Page 286) - Building the Bookstore Application Using JSF 2 (Page 290) - Integrating JSF with Spring Framework (Page 292) - Accessing a Database from the Web Layer via Spring JDBCTemplate (Page 293) - Developing Templates (Page 295) - Developing the User Interface Using UI Components and JSF EL (Page 296) - Summary (Page 300) - Chapter 7: Rapid Web Development with Grails (Page 301) - Grails Features (Page 301) - Convention over Configuration (Page 302) - Scaffolding (Page 302) - Object-Relational Mapping (Page 302) - Plug-Ins (Page 303) - Unit Testing (Page 303) - Integrated Open Source (Page 303) - Installing Grails (Page 304) - Hello World Application (Page 304) - Bookstore Application (Page 307) - Creating the Bookstore Application (Page 307) - Running the Application (Page 314) - Creating the Controller (Page 316) - Testing the Controller (Page 319) - Creating a Domain Class (Page 323) - Scaffolding (Page 327) - Dynamic Scaffolding (Page 327) - Static Scaffolding (Page 331) - Calling the render( ) Method (Page 333) - Calling the redirect( ) Method (Page 334) - Returning a Model (Page 335) - Index Action (Page 335) - List Action (Page 335) - Create Action (Page 336) - Save Action (Page 336) - Show Action (Page 337) - Edit Action (Page 337) - Update Action (Page 338) - Delete Action (Page 339) - Grails Views (Page 339) - The List View (Page 341) - The Create View (Page 342) - The Show View (Page 343) - The Edit View (Page 345) - H2 Console (Page 347) - Creating Domain Relationships (Page 349) - Summary (Page 356) - Chapter 8: Play with Java and Scala (Page 357) - Features of Play 2 (Page 358) - MVC in Play 2 (Page 358) - Router (Page 359) - Controller (Page 359) - Model (Page 360) - View (Page 360) - Getting Started with Play (Page 360) - Hello World Java Application with Play (Page 362) - Configuring Eclipse for Java (Page 368) - Helloworld Scala Application with Play 2 (Page 372) - Configuring Eclipse for Scala (Page 374) - A Basic CRUD Play 2 Java Application (Page 375) - Defining the Routes (Page 375) - Creating the Controller and Actions (Page 376) - Creating the Model (Page 377) - The Form and the View Template (Page 378) - Accessing the Database (Page 381) - Deleting Books (Page 384) - Summary (Page 384) - Appendix A: Introduction to Java (Page 385) - Classes and Objects (Page 385) - Variables (Page 386) - Instance Members (Page 386) - Static Members (Page 387) - Method Overloading (Page 388) - Arrays (Page 388) - Constructors (Page 389) - Encapsulation (Page 391) - Inheritance (Page 391) - Constructor Chaining (Page 393) - Polymorphism (Page 395) - Summary (Page 400) - Appendix B: Introduction to Groovy (Page 401) - Getting Started (Page 401) - GroovyShell (Page 403) - GroovyConsole (Page 404) - GStrings (Page 407) - Single-Line Strings (Page 407) - Multiline Strings (Page 408) - Slashy Strings (Page 409) - Multiline Slashy Strings (Page 409) - Dollar Slashy Strings (Page 410) - Collective Datatypes (Page 411) - Arrays (Page 412) - Lists (Page 412) - Maps (Page 413) - Ranges (Page 414) - Sets (Page 416) - Methods (Page 416) - Closures (Page 417) - Understanding Closures (Page 417) - Implicit Variables (Page 419) - Explicit Declaration of Closure (Page 420) - Reusing the Method as a Closure (Page 420) - Passing a Closure as a Parameter (Page 421) - Specialized Operators (Page 421) - Spread Operator (Page 421) - Elvis Operator (Page 421) - Safe Navigation/Dereference Operator (Page 422) - Field Operator (Page 423) - Method Closure Operator (Page 423) - Diamond Operator (Page 424) - Summary (Page 424) - Appendix C: Introduction to Scala (Page 425) - Getting Started with Scala (Page 425) - Using the Interactive Interpreter (Page 425) - Executing Scala Code as a Script (Page 426) - Compiling Scala Code (Page 426) - Variables (Page 428) - Collections (Page 428) - Lists (Page 429) - Sets (Page 430) - Maps (Page 430) - Classes (Page 431) - Extending a Class (Page 431) - Traits (Page 433) - Singleton Objects (Page 434) - Summary (Page 435) - Index (Page 436)