Servlet JSP Tutorial With Examples

Servlet JSP technologies are backbone of Java EE programming. Recently I have written a lot about Servlet and JSP programming and this is a summary post for Servlet JSP Tutorials where I am providing all the article links in the order to read them.

Servlet JSP Tutorial

Java Web Application Tutorial for Beginners

This is the first article in the Java Web Applications tutorial and you will learn about core concepts of web application and how we can use Eclipse to create our first web application. This article provide details about web server, client, HTTP and HTML, URL, Web Container, Web Archive directory structure and Deployment descriptor configurations. This article also includes the “Hello World” servlet example.

Java Servlet Tutorial for Beginners

This tutorial provide details about Servlet and it’s benefits over CGI. The article provide details about Servlet API and it’s main interfaces and classes. We also look into Servlet 3 annotations in brief details that is used in further tutorials. We also learn about servlet attributes and create our Servlet Login Example project.

Servlet Session Management

This article explains about Session and different ways of session management. We learn how we can use Cookies and Servlet API HttpSession interface to maintain user session. We also learn how to use URL rewriting techniques for session management when cookies are disable at client side.

Servlet Filter

Learn about Servlet Filter and how we can use it to intercept request and response objects and manipulate them in between. The article explains about Filter interface, WebFilter annotation, Servlet Filters configuration in web.xml and provide example for logging client requests and session validation with Filters.

Servlet Listener

We explore about Servlet Listener and it’s benefits in this article. We learn about Servlet Listener interface and Event objects and see working example of ServletContextListener, ServletContextAttributeListener, HttpSessionListener and ServletRequestListener with an example program.

Cookies in Servlet

Cookies are used a lot in server client communication. Servlet API HttpSession uses cookie for session management. Here we learn about Servlet Cookie class and how we can use it to add cookies in response and get cookie details from request object with example program.

Servlet Exception Handling

Here we explore about the Exception Handler servlets that we can use to generate custom error message to be sent to client when exception is thrown by Servlet service methods.

Servlet Upload Download File Example

Upload File and Download File scenario is very common in web applications. Here we will learn how we can use Apache Commons FileUpload API to upload file from local system to server and how we can use Servlet for download file and hide the actual file location from the user.

Servlet 3 File Upload using MultipartConfig annotation and Part interface

Servlet 3 specs added support for uploading file without using any third party APIs, this post explains about Servlet API MultipartConfig annotation, Part interface and HttpServletRequest methods that we can use to upload file on server.

Servlet Database Connection and Log4j integration

Most of the web applications connect to database and use log4j for logging purpose. A very detailed post with complete example showing how we can use Listeners and servlet context attributes for Database connection and log4j integration with example project.

Tomcat DataSource JNDI Example

Most of the web application use some relational databases and DataSource is the preferred way to get the database connection. This post will explain you different ways to configure DataSource in Tomcat container and how we can use it in the Servlet based web application.

Servlet Web Application Spring Security Integration

We can use Spring Security module to implement authentication and authorization in our servlet based web application. This tutorial shows you how to do it with a simple example.

Hibernate Servlet DataSource Example

Hibernate is one of the most widely used Java based ORM tool and we can easily integrate it in the servlet based web application. This tutorial provides you basic details about Hibernate and how easily we can integrate it in our web application using Tomcat container JNDI DataSource.

Async Servlet

Servlet 3 introduced asynchronous support in Servlet that is very helpful in getting higher throughput for long running servlets. We can offload the processing to another thread using async servlet, learn async servlet implementation with example program.

Servlet Interview Questions

A collection of 50 servlet interview questions with detailed answers to help you in Java EE interview. It is advisable to go through the tutorial first and then try to answer the questions yourself to check your understanding.

JSP Tutorial

JSP Example Tutorial for Beginners

This is the first post in the JSP series. This post explains about JSP and it’s benefits over servlets, JSP API interfaces, JSP lifecycle phases and methods, JSP comments, JSP scripting elements, scriptlets, JSP expression, JSP directive, JSP declaration, JSP attributes, JSP translation to Servlet with example program. This is a great post to start with if you are new to JSP and want to learn it’s basics.

JSP Implicit Objects

JSP creates 9 objects at the start of service method and we can use them directly in JSP scriptlets, these are called JSP implicit objects. This post provide details about the JSP implicit objects and how we can use them in JSP page with example program.

JSP Directives

JSP directives are used to provide specific instructions to JSP translator when JSP page is translated to Servlet. This post explains about JSP page directive and include directive in detail and their attributes. JSP taglib directive is used for JSTL or custom tags and explained in later tutorials.

JSP Exception Handling

We can create JSP error pages to handle exceptions thrown by application and provide custom response to client. This post explains about the JSP error pages, their configuration in deployment descriptor with example program.

JSP EL Tutorial

JSP Specs 2.0 introduced Expression Language (EL) through which we can get attributes and parameters easily using HTML like tags. This post explains about JSP EL implicit objects, EL operators and their precedence, EL reserve keywords and EL usage with sample program.

ction Tags

JSP provides a bunch of standard action tags that we can use for specific tasks such as working with java bean objects, including other resource, forward the request to other resource etc. This post provide details about all the JSP action elements and show usage of JSP Bean, JSP Forward and JSP include action usage with example program.

JSTL Tutorial

JSP Standard Tag Library (JSTL) is the standard tag library that provides tags to control the JSP page behavior, iteration and control statements, internationalization tags, and SQL tags. This post provide details about the different types of JSTL tags. You will also get details of JSTL Core Tags and their usage with example program.

JSP Custom Tags

Sometimes JSP EL, Action Tags and JSTL are not enough and we may get tempted to write java code in scripting elements. Fortunately JSP is extendable and we can create our own custom tags to be used in JSP pages. This post provide steps to create JSP custom tags and how we can configure and use that in JSP page with example program.

JSP Interview Questions and Answers

This post provides a huge list of JSP interview questions with detailed answers to tackle JSP related interview questions in Java EE interviews. The questions are for beginners as well as experienced programmers, please have a look.

Thats all for Servlet JSP tutorial. I will be adding more tutorials related to some JSP programming scenario. Servlet Security, JSTL tags etc; so make sure you bookmark it for future use.

By admin

Leave a Reply

%d bloggers like this: