Java EE Tutorial covering JSP 2.2, and Servlets 3.0
From Resin 4.0 Wiki
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 JSP and Servlets, but this tutorial is going to be different in that 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 one of several Servlet/JSP Containers that support CDI.
- 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.
Cookbooks and Tutorials
- Building a simple listing in JSP: covers model 2, Servlets, JSP intro.
- Java EE Servlet tutorial : Adding create, update and delete to the bookstore listing: covers more interactions.
- Java EE Servlet tutorial : Using JSPs to create header, footer area, formatting, and basic CSS for bookstore.
- Java EE Servlet tutorial : Adding MySQL and JDBC to bookstore example.
- Java EE Servlet/JSP tutorial : Adding an error page, logging, and other forms of debugging.
- Java EE Servlet tutorial : Adding validation and JSP tag files to bookstore example.
- Java EE Servlet tutorial : Adding I18N support to bookstore example.
- Java EE Servlet tutorial : Load testing and health monitoring using bookstore example.
- Java EE Servlet tutorial : Setting up clustering and session replication.
- Java EE Servlet tutorial : Setting up security for bookstore example.
- Java EE Servlet tutorial : File uploads for bookstore example.
- Java EE Servlet tutorial : Using JPA for bookstore example.
- Java EE Servlet tutorial : Using JCache for bookstore example.
Each cookbook will eventually have a corresponding slide deck, video and source code on github associated with it.
- Source code hosted on github
There are a few more videos and slide decks in the work.
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
- Unified EL
- Tag files
- Servlet Filters
- Servlet 3 extension points
- JSP EL
- File uploads
- JDBC / RDBMS
- Session replication
- Cloud deployment
- HTML 5
- Long polling
- Load Balancing
- HTTP Caching
- Performance tuning
- JCache / Memcached
- Load balancing
- Quercus/PHP for Java (good comparative discussions of JSP and PHP)
- Rewrite rules
- Health monitoring / Garbage collection
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)
- Any framework above and beyond Java EE 6 that has significant overlap with Java EE 6