Home » Tag Archives: servlet lifecycle

Tag Archives: servlet lifecycle

Java Servlet File Download and File Upload Example

Hello readers, in this tutorial, we will show you how to set up the File Upload and Download functionality in a Servlet based Java web application.                     Table Of Contents 1. Introduction 1.1 What is Servlet? 1.2 Servlet File Upload 1.3 Servlet File Download 2. Java Servlet File Download and File ...

Read More »

Java Servlet Security Example

The @ServletSecurity annotation is used to define the access control or the security constraints to the servlets. In this tutorial, we will see how to configure the Basic Authentication in the servlets. 1. Introduction If developers are planning on using the Basic Authentication they must be aware that if they use the plain HTTP requests, the username, and password can ...

Read More »

Java Servlet Session Timeout Configuration Example

In this tutorial, we will show you how to set up the Session Timeout in a Servlet based web application. 1. Introduction Tomcat has a default timeout of 30 minutes but the default timeout depends on different web containers. The default session timeout in a web application can be configurable in two ways:         1.1 Session Timeout ...

Read More »

Java Servlet Exception Handling Example

When a servlet generates an error developers can handle those exceptions in various ways, let’s say a user tries a URL that does not map to a servlet the user typically gets a 404 page. With the error listing in the deployment descriptor, we can handle those exceptions. In this tutorial, we will see how to tackle these exception handling ...

Read More »

Java Servlet ServletConfig vs ServletContext Example

Servlets are modules of the Java code that run in a server application to answer the client requests. ServletContext and ServletConfig are two important interfaces of the Servlet API which is used by Java J2EE programmer during the web application development. In this tutorial, we will see how the ServletContext and ServletConfig are different from each other. 1. Introduction The ...

Read More »

Java Servlet SendRedirect Example

Communication between the Servlets is an important task to the programmer. sendRedirect() can be used to communicate between two servlets present in the different servers. The output will be the same as the Request Dispatcher Forward example but the URL of the page will be changed to the redirected page. In this tutorial, we will see how the sendRedirect() method ...

Read More »

Java Servlet Life Cycle Example

Servlets are modules of the Java code that run on a server application to answer the client requests. They are not tied to a specific client-server protocol but are most commonly used with HTTP and the word “Servlet” is often used in the meaning of “HTTP Servlet“. In this tutorial, we will explain the Servlet Lifecycle. 1. Introduction Servlet is ...

Read More »

Java Servlet Filter Example

Servlets are modules of the Java code that run in a server application to answer the client requests. In this tutorial, we will explain how to implement the Servlet Filter API to handle the client requests. 1. Introduction Servlet is a Java program which exists and executes in the J2EE servers and is used to receive the HTTP protocol request, ...

Read More »

Java Servlet Application for Login Page

Servlets are modules of the Java code that run in a server application to answer the client requests. They are not tied to a specific client-server protocol but are most commonly used with HTTP. The word “Servlet” is often used in the meaning of “HTTP Servlet“. In this tutorial, we will explain how to handle the Servlet HTTP POST Request ...

Read More »

Java Servlet Url Parameters Example

Servlets are modules of the Java code that run in a server application to answer the client requests. They are not tied to a specific client-server protocol but are most commonly used with HTTP. The word “Servlet” is often used in the meaning of “HTTP Servlet” . In this tutorial, we will explain how to handle parameters of the Servlet ...

Read More »