How singleton pattern works in java

Singleton pattern is a design solution where an application wants to have one and only one instance of any class, in all possible scenarios without any exceptional condition. There are several ways to implement the singleton pattern. The following sections will give an idea how singleton pattern is implemented.

Override equals() and hashCode() method in java

In Java, every object has access to the equals() method because it is inherited from the Object class. However, this default implementation just simply compares the memory addresses of the objects. You can override the default implementation of the equals() method defined in java.lang.Object. If you override the equals(), you must override hashCode() otherwise a […]

Encryption and decryption using RSA in java

Introduction RSA is a cryptosystem, which is known as one of the first practicable public-key cryptosystems and is widely used for secure data transmission. In such a cryptosystem, the encryption key is public and differs from the decryption key which is kept secret. In RSA, this asymmetry is based on the practical difficulty of factoring […]

Spring 3, JSF 2 and Hibernate 3 integration example

I will show how to integrate Spring 3, JSF 2 and Hibernate 3 in the following example. You may also read JSF 2, Spring 4, Hibernate 4 and Maven Integration Download the required jars for Spring from, JSF from and Hibernate from Create web application using NetBeans or Eclipse or any Java […]

Prevent browser from caching resources

Sometimes we need to clear the browser cache or prevent the browser from caching resources so that we always get the latest output from the server. Disabling caching of your webpages ensures your resources come from the server each and every time. In every browser, you’ll find the option to disable caching or even you can […]

Cache static resources like css, js and images for a specific time period

Static resources like css, js images etc. need not be reloaded from the server every time until and unless we want the old one needs to be replaced by the new one. Sometimes we need to cache static resources so that performance of the site can be improved over the time. Cache is defined as […]

Integrate Spring 3, Struts 2 and Hibernate 3

Introduction This tutorial shows how to integrate Spring 3, Struts 2 and Hibernate 3 in the following example. In this example, Struts 2 will be used as a web framework and Spring 3 will be used as a core service. We will use ORM (Object Relational Mapping) framework Hibernate for our persistent layer to interact […]

Scroll to top