Submitted by heartin on Tue, 03/17/2015 - 13:57
Observer pattern is a behavioral design pattern where a collection of objects called observers listens for the state change of another object called subject. Observer pattern defines a one-to-many relationship between the subject and one or more of observers. The subject object maintains a list of its observer objects, and notifies those observers automatically if there are any state changes for the subject, usually by calling one method of the observer.
Submitted by heartin on Sat, 03/14/2015 - 20:07
When a request is forwarded or included using the RequestDispatcher mechanism, the container may change the URI paths (request uri, context path, servlet path, path info and query string) in the request object to reflect new path.
This can be demonstrated using a simple example.
First, we will create an util class with a method to print the current values of all these URI path attributes and call it from a normal servlet, included servlet and forwarded servlet.
Submitted by heartin on Sat, 03/14/2015 - 13:22
All calls to other resources in a web application should go through the container. RequestDispatcher is a mechanism provided by the container for that purpose. Container will give us an implementation of the RequestDispatcher interface and we can use it to delegate control to other resources in the application.
You can obtain RequestDispatcher object from
Submitted by sneha on Sat, 03/14/2015 - 12:50
In this demo, we will create a listener and then add, remove and delete attributes from the request object so that the listener methods are invoked.
Follow the below steps in order. You should have already configure apache tomcat with eclipse as mentioned in configuring-apache-tomcat-with-eclipse.
Create a new Dynamic Web project in eclipse as:
Submitted by heartin on Thu, 03/12/2015 - 18:04
The strategy pattern is a behavioral pattern that defines a family of algorithms, encapsulates each one of them and makes them interchangeable. According to this pattern, a different class is created for each interchangeable algorithm, and this class can be injected anytime, even at runtime.
Components and working of Strategy Pattern
Important components of strategy pattern are:
Pages