Introduction to Servlet technology
Chapters
Setting up environment for Servlets
Like other Java program servlet can be compiled using javac compiler, it can be deployed in configured environment to run.
Setting up Java Development Kit
The step involve downloading an implementation of Java Software Development Kit (SDK) and setting up of PATH environment variable appropriately.
Java SDK can be downloaded from Oracle's Java site: Java SE Downloads.
Click on JDK download.
After the setup files are download double click on the downloaded exe and install JDK
After installation is complete, Configure PATH and JAVA_HOME in environment variables section. We will also need to create a new variable called JAVA_HOME. An example paths that would want to put in are shown below but these paths will change depending on where you end up installing JDK in the first place anyway.
PATH = C:\Program Files\Java\jdk1.8.0_40\bin;
JAVA_HOME= C:\Program Files (x86)\Java\jdk1.8.0_40
Here is how we created JAVA_HOME variable under windows OS and edited Path variable
Once set, open command prompt and to verify that JAVA_HOME is set correctly, run this command below
Setting up Web Server: Tomcat
Apache Tomcat is open source software implementation for Java Servlet and Java Server Pages technologies which act as standalone server for testing servlets and integrated with Apache Web Server. The Steps for setup of Tomcat:
- Latest version of Tomcat can be Download from http://tomcat.apache.org/.
- After download unpack binary distribution into a convenient location. Example C:\apache-tomcat-8.0.21 on windows
- Configure CATALINA_HOME in environment variable section by adding New User Variable for CATALINA_HOME.
- Verify the CATALINA _HOME path by typing below command in command prompt.
- Start Apache Web Server by running startup.bat from Command Prompt.
After tomcat starts up, default web applications will be running in http://localhost:8080/.
Now that we have set ourselves up to pay with servlets, let's jump into understanding life cycle of a servlet in next part of this quick start tutorial on Servlets.
Description
This guide introduces Servlet technology and we will cover below topics
- What is a Servlet?
- Initial Setup
- Life Cycle
- Various Examples
- Client Request
- Server Response
- Http Status Codes
- Writing Filters
- Exception Handling
- Cookies Handling
- Session Tracking
- Database Access
- Packaging
- Internationalization
This is to the point introduction to the topic to get you started
Prerequisites
Working knowledge of Core Java is essential
Audience
Beginner to Java Servlet technology or students looking to brush up their skills quickly
Learning Objectives
Learn Java Servlets
Author: Subject Coach
Added on: 2nd May 2015
You must be logged in as Student to ask a Question.
None just yet!