Category: Java
ServletContextAttributeListener Example Use Case
This example explains how to use a ServletContextAttributeListener in a web application. This interface is used for receiving notification events about ServletContext attribute changes. In order to receive these notifications the ServletContextAttributeListener needs to...
ServletContextListener a Servlet 3 Listener on Startup
You can listen to the startup of you web application with ServletContextListener. ServletContextListener allows you to initialise your application when it is deployed. Or clean up resources when the application is destroyed. In Servlet...
Servlet HTTP Request Parameters Example
In this tutorial we will show you how to handling servlet HTTP request parameters. The HTTP request parameters are sent along with the request. You can send request parameters as part of the URL...
Servlet Attributes request session and application scope
In this tutorial we will talk about servlet attributes. Attributes can be objects not just strings and are used to pass data between requests. For a web application it is essential to pass data...
Servlet 3 Exception Handling example
In this tutorial we will tackle servlet 3 exception handling. When a servlet generates an error we can handle those exceptions on various ways, lets say a user tries a URL that does not...
Servlet Context Parameter Example Configuration
In this tutorial we will show how you can use the servlet context parameter to inject in a servlet. We can configure our servlet entirely with annotations, but as the context parameters are meant...
Servlet 3 initialisation parameter annotation @WebInitParam
We will show how you can use the servlet 3 initialisation parameter annotation @WebInitParam to inject initialisation parameters in our servlet. We can configure our servlet entirely with annotations which means no more web.xml...
Servlet 3 web.xml Example Configuration
A servlet is a Java class that extends the javax.servlet.Servlet interface. To handle HTTP request you need to extend the javax.servlet.http.HttpServlet abstraction. Servlets interact with Web clients via a request/response paradigm implemented by the...
Servlet 3 Annotation Example Configuration
A servlet is a Java class that extends the javax.servlet.Servlet interface. To handle HTTP request you need to extend the javax.servlet.http.HttpServlet abstraction. Servlets interact with Web clients via a request/response paradigm implemented by the...