Java EE Tutorial covering JSP 2.2, and Servlets 3.0

From Resin 4.0 Wiki

Revision as of 00:00, 27 April 2012 by Rick (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Java EE, CDI, Servlet 3.0 and JSP 2.2 tutorial

This tutorial focuses on using Servlet's and JSP the right way. Servlet and JSP have evolved over the years, and now there is often more than one way to do things. For example, this tutorial uses EL and JSTL not JSP scriptlets, it uses JSPs in a Model 2/MVC style not in a model 1 style, etc. Consider it a tutorial that focuses only on the best practices and not the legacy ways to do things.

There are other tutorials on this subject, but this tutorial is going to be different in that it is going to put all code into github, and you can follow along with Eclipse. Also instead of focusing on JSF, we are going to focus on JSP and Servlets as the main view technology.

Java EE, JSP and Servlets have added a lot of features that are in other frameworks, making those other frameworks

less relevant then they were before Java EE garnered these extra abilities. Even is you decide to use JSF, Struts, 
Stripes, Spring MVC, JSF, etc., this tutorial should help you have a better understanding
of the JSP/Servlets core that they build on.

We are going to start by building a simple bookstore. We will progressively add more features to the bookstore and as we do we will use more of Java EE/CDI, JSP and Servlets.

For this tutorial, I am going to use Resin 4.0.x, but you could use any Java EE 6 Web Profile compliant application server.

Tutorial style

  • Not going to list every option of every tag, configuration, etc.
  • Not going to teach you something you are suppose to avoid anyway or that is deprecated
  • Build something real enough to ensure that things actually work and we don't miss something common
  • Don't build something too real so that the concepts are hard to ascertain outside of the domain of the example
  • Provide cook books on how to do common tasks like I18n, etc.
  • IDE, Performance testing, Debugging, etc. from the start!

I can go on and on about each point. I've seen a lot of tutorial and books out there, and they drag you down with detail you don't need. (You can alway google it later). Or, they skip out very important things because their examples are too simple.


Resources

  • Slides
  • Wiki
  • Source code hosted on github
  • Videos

Feedback

Feedback welcome. If you see something crazy or less efficient then it needs or a new API I missed, etc., let me know. (rick AT caucho dot com). I don't know everything, and I welcome feedback.

In scope (In no particular order)

  • Eclipse WTP
  • JSP
  • Unified EL
  • Tag files
  • Servlet Filters
  • Servlet 3 extension points
  • JSP EL
  • JDBC
  • JPA
  • File uploads
  • JDBC / RDBMS
  • NoSQL
  • CDI
  • Session replication
  • Cloud deployment
  • Internationalization
  • JavaScript
  • Ajax
  • HTML 5
  • Validation (standard, and JavaScript)
  • WebSockets
  • Long polling
  • Load Balancing
  • HTTP Caching
  • Performance tuning
  • maven
  • JCache / Memcached
  • Clustering
  • Load balancing
  • Quercus/PHP for Java (good comparative discussions of JSP and PHP)
  • JMX
  • Rewrite rules
  • Health monitoring / Garbage collection
  • etc.

The idea behind this tutorial is that you can build your Java knowledge and web development foundation. If you are new to Java web development or have been doing it a while, but just don't get the ins and outs, then this tutorial will hopefully help you get to the next level.

Out of scope

  • JSF (maybe later, but not before we really explore the core)
  • Spring
  • Struts
  • Seam
  • NetBeans
  • Any framework above and beyond Java EE 6 that has significant overlap with Java EE 6

Cookbooks and Tutorials

Building a simple listing in JSP

Personal tools
TOOLBOX
LANGUAGES