You are previewing Learn Java for Web Development: Modern Java Web Development.
O'Reilly logo
Learn Java for Web Development: Modern Java Web Development

Book Description

Web development is still one of today's most popular, active, and important programming and development activities. From a single web page to an e-commerce-enabled web site to a fully-fledged web application, the Java programming language and its frameworks allow you great flexibility and productivity for your web application development.

Learn Java for Web Development teaches web developers who are new to Java key skills, Java-based languages, and frameworks to build simple or complex web sites and applications. As soon as you pick up this book, Vishal Layka's experience guides you on a very practical learning and building journey.

You will learn the Java nuts and bolts necessary to build a simple "HelloWorld" Java (native) application, as well as a "HelloWorld" Java-based web application example that utilizes servlets and Java Server Pages (JSPs). Over the course of the book, you'll learn more about servlets and JSPs and delve into Java Server Faces (JSFs) and the expression language found in each of these by applying them in a real-world case study—a book store e-commerce application. Then you'll build your web application using Apache Struts2 and the Spring MVC framework.

The book concludes by exploring the web application that you've built and examining industry best practices and how these might fit with your application, as well as covering alternative Java Web frameworks like Groovy/Grails and Scala/Play 2. You also can explore the basics of Java, Groovy, and Scala in the book's appendices.

While reading this book, you'll see all this in action and you can use it as a starting point for further Java web development. Study and experiment with the many source code examples, and later apply them to your own web application building endeavors and 2:00 AM challenges.

What you'll learn

  • How to build your first Java-based web applications with servlets and JSPs

  • How to apply best practices to web application development

  • How to build web applications with JSF 2

  • How to build web applications with the Struts2 framework

  • How to build web applications with the Spring 3 Web MVC framework

  • How to build web applications with Grails and Play 2

  • How to debug and deploy your web application along the way

Who this book is for

This book is for current or aspiring web developers who have some programming experience, but have no or little prior experience using the Java programming language and the available frameworks for Java in web development.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Introduction
  8. Chapter 1: Introducing Java Web Development
    1. JVM Languages
    2. Java EE
    3. Java Web Frameworks
    4. Getting Started with Java
    5. The Bookstore Application
    6. Data Model for the Bookstore Application
    7. Trends and Technologies in the Java Web Landscape
    8. Summary
  9. Chapter 2: Building Web Applications Using Servlets and JSP
    1. Servlets
    2. Java Server Pages
    3. The MVC Pattern
    4. Bookstore Application
    5. Summary
  10. Chapter 3: Best Practices in Java EE Web Development
    1. Best-Practice Solutions: Using EL and JSTL
    2. Best-Practice Solutions: Using Patterns
    3. Java Web Frameworks
    4. Summary
  11. Chapter 4: Building a Web Application Using Struts 2
    1. Struts 2 Framework Overview
    2. Action
    3. Interceptors
    4. ValueStack and OGNL
    5. ResultType and Result
    6. Struts 2 Tags
    7. Getting Started with Struts 2
    8. Bookstore Web Application
    9. Summary
  12. Chapter 5: Building Java Web Applications with Spring Web MVC
    1. Spring Framework Overview
    2. Spring Framework Fundamentals
    3. Key Objectives of the Spring Framework
    4. Building Web Application with Spring Web MVC
    5. Summary
  13. Chapter 6: Component-Based Web Development Using JSF 2
    1. The Architecture of JSF
    2. Getting Started with JSF
    3. Life Cycle of a JSF Application
    4. Managed Beans
    5. Facelets
    6. Building the Bookstore Application Using JSF 2
    7. Summary
  14. Chapter 7: Rapid Web Development with Grails
    1. Grails Features
    2. Installing Grails
    3. Hello World Application
    4. Bookstore Application
    5. Scaffolding
    6. H2 Console
    7. Creating Domain Relationships
    8. Summary
  15. Chapter 8: Play with Java and Scala
    1. Features of Play 2
    2. MVC in Play 2
    3. Getting Started with Play
    4. A Basic CRUD Play 2 Java Application
    5. Summary
  16. Appendix A: Introduction to Java
    1. Classes and Objects
    2. Variables
    3. Method Overloading
    4. Arrays
    5. Constructors
    6. Encapsulation
    7. Inheritance
    8. Constructor Chaining
    9. Polymorphism
    10. Summary
  17. Appendix B: Introduction to Groovy
    1. Getting Started
    2. GStrings
    3. Collective Datatypes
    4. Methods
    5. Closures
    6. Specialized Operators
    7. Summary
  18. Appendix C: Introduction to Scala
    1. Getting Started with Scala
    2. Variables
    3. Collections
    4. Classes
    5. Traits
    6. Singleton Objects
    7. Summary
  19. Index