Bill Digman is a Java EE / Servlet enthusiast and Open Source enthusiast who loves working with Caucho's Resin Servlet Container, a Java EE Web Profile Servlet Container. Bill has posted 12 posts at DZone. You can read more from them at their website. View Full User Profile

Tutorial covering JSP 2.2 and Servlets 3.0 with OpenSource Resin Servlet Container: Part 1

10.25.2012
| 25605 views |
  • submit to reddit

Java EE: 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.

Tutorial Style

  1. Not going to list every option of every tag, configuration, etc. (maybe later).
  2. Not going to teach you something you are suppose to avoid anyway or that is deprecated
  3. Build something real enough to ensure that things actually work and we don't miss something common
  4. Don't build something too real so that the concepts are hard to ascertain outside of the domain of the example
  5. Provide cook books on how to do common tasks like I18n, etc.
  6. 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

  1. Building a simple listing in JSP: covers model 2, Servlets, JSP intro.
  2. Java EE Servlet tutorial: Adding create, update and delete to the bookstore listing: covers more interactions.
  3. Java EE Servlet tutorial: Using JSPs to create header, footer area, formatting, and basic CSS for bookstore
  4. Java EE Servlet tutorial: Adding MySQL and JDBC to bookstore example
  5. Java EE Servlet/JSP tutorial: Adding an error page, logging, and other forms of_debugging

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.

Bill Digman is a Java EE / Servlet enthusiast and Open Source enthusiast who loves working with Caucho's Resin Servlet Container, a Java EE Web Profile Servlet Container.

 

Caucho's Resin OpenSource Servlet Container

 

Java EE Web Profile Servlet Container

 

AttachmentSize
Tutorial covering JSP 2.2 and Servlets 3.0 with OpenSource Resin Servlet Container - Part 1.pdf849.79 KB
Published at DZone with permission of its author, Bill Digman.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Bruce Phillips replied on Thu, 2012/10/25 - 11:00am

This is a good article but it could be made much,  much better by providing two items

 

1.  Code download

2.  PDF version that a reader can save to read later or to refer to when needed.  It is very tedious to click through 15 web pages where on each  page the ads and other crap overwhelm the important content.

 

 

Bill Digman replied on Thu, 2012/10/25 - 3:12pm in response to: Bruce Phillips

I'll work on a PDF version right away.

How do you suggest I provide code download?  

Bill Digman replied on Thu, 2012/10/25 - 4:29pm in response to: Bill Digman

The PDF version is attached

Bruce Phillips replied on Thu, 2012/10/25 - 7:02pm in response to: Bill Digman

Thank you very much for the PDF version. 

For the code you could use Eclipse - Export as archived projected which creates a zip of your project.  Other Eclipse users can then import the project directly from the zip.  Non-Eclipse users can unzip the project and view the files also.

 

Henk De Boer replied on Fri, 2012/10/26 - 12:11pm

It's thorough and explains things well, but it's a somewhat confusing setup.

The material being explained; Servlets, JSP and then Scriptlets vs JSTL feels like it comes straight from the early 2000s, but then we do see relative modern annotations on the Servlets and even the use of CDI.

Bill Digman replied on Thu, 2012/11/01 - 11:38am in response to: Henk De Boer

Yep... This is true. In a future article we are going to cover a more CDI centric approach covering @Produces @RequestScoped. Later we will cover JPA, JAX-RS, JCache, etc. and yes maybe even JSF (grumble, grumble)....

Bill Digman replied on Thu, 2012/11/01 - 11:39am

Stay tuned. I have a lot more to say. I think Java EE is more of a cafeteria plan than a one size fits all. You can use Servlets, CDI and JSP for model 2 apps. JAX-RS for RIA clients. Websockets, JCache, etc. Most tutorials wrt Java EE seem to really push JSF and EJB. If you tie Java EE to JSF and EJB and I think it turns a lot of folks off. Java EE is more than this.

Sam Noor replied on Fri, 2012/12/21 - 4:38am

 I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You. http://www.ileatherwear.com !! *Leather outfit* http://www.ileatherwear.com/offer/wwii-bomber-jacket.html !! *Wwii bomber jacket* http://www.ileatherwear.com/offer/white-leather-jackets-for-women.html !! *White leather jackets for women* http://www.ileatherwear.com/offer/tan-leather-jacket-women.html !! *Tan leather jacket women*

Keenee Madison replied on Thu, 2013/10/31 - 6:33am

JSP technology enables rapid development of web-based applications that are server- and platform-independent.  

WordPress Plugin development

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.