Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Introduction into Java Web development

Lars Vogel

Version 0.5

30.09.2010

Revision History
Revision 0.109.04.2009Lars Vogel
Created
Revision 0.2 - 0.5 18.05.2009 - 30.09.2010Lars Vogel
bug fixed and enhancements

Java Web technologies

This article gives an overview of the standard web technologies for Java. It explains the terms web applications, servlets, JSPs and web container.


Table of Contents

1. Web development
1.1. Overview
1.2. Web development
1.3. Container
1.4. Java hosting at Google
2. Java Web application
3. Java Web Standards
3.1. Servlet
3.2. JavaServer Page
3.3. JavaServer Pages Standard Tag Library
3.4. Try it out
4. Non standard based Java Web Development
5. Thank you
6. Questions and Discussion
7. Links and Literature
7.1. Java Webdevelopment
7.2. vogella Resources

1. Web development

1.1. Overview

Java has strong support for web development. The following gives an overview of the available Java technologies starting with with an explanation of web applications and then highlighting important standards in Java. After you finished the overview you can create your first Java web application with Servlet and JSP development with Eclipse WTP.

1.2. Web development

If you develop a web application (independent of the programming language your are using) your put your web application on a server (and not your local computer). The web application runs on the server and people can access it there. The server is either a real machine (with CPU, memory, harddisk, etc.) or a virtual server which is basically a machine which is separated by software into smaller machines.

Instead of running your application directly on a dedicated server you could also run it in a cloud environment. This cloud environment provides the necessary server for your application. An example for this is the Google App Engine .

Of course it is possible to use your local computer as a server but usually you want to have a fixed server which runs 24 hours and 7 days so that web clients can always reach your server under a pre-defined address. For example vogella.de blog contains my blog. My blog is a web application powered by Wordpress. Wordpress is a web application written in the programming language "php".

1.3. Container

Java web applications are typically not running directly on the server. Java web applications are running inside a container on the server. This container runs on the server. The container provides a runtime environment for Java web applications. The container is for Java web applications what the JVM (Java Virtual Machine) is for local running Java applications. The container itself runs in the JVM.

In general Java distinguish two containers: the web container and the Java EE container. Typical web container in the Java world are Tomcat or Jetty. A web container supports the execution of Java servlets and JavaServer Pages. A Java EE container supports additional functionality for example distribution of server load.

Most of the modern Java web frameworks are based on servlets and JavaServer Pages. Popular Java web frameworks are JavaServer Faces, Struts, Spring. These web frameworks usually can run in a web container.

1.4. Java hosting at Google

Traditionally is has been difficult to start Java web development as a server was required for hosting the Java web container. Google offers a free of charge (for starters) solution based on Java. For details see Java Development on the Google App Engine