Strategy Pattern

Reading Time: 1 minute This pattern is listed in Behavioral pattern which allows you to define sets of algorithms in the parent class which will be extended by sub classes in which all the given algorithms are interchangeable. The best way to observe this pattern is to study the below example. public abstract class Employee { public abstract int

Forwarding to a page from controller

Reading Time: 1 minute This is very useful when you compare that a passed object is null in the forthcoming controller you may directly forward user to a different page or maybe assign a message regarding the issue that the user had faced this error it depends on your development favorite FacesContext.getCurrentInstance().getExternalContext().redirect(“index.jsf”);  

Passing objects between managed beans&controllers

Reading Time: 1 minute in the source controller add your object into faces session map interface and identify it with a name FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(“category”, category); then in the target controller to acquire the object do the following Category category = (Category) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(“category”);

Java Lambda Expressions Collections Example

Reading Time: 3 minutes I was wondering new features in Java 8 and wanted to play around with Lambda expressions. So I’ve eventually ended up preparing some collection examples. Hope you’ll easily summarize and understand it The Code package; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; public class CollectionExample { public static void main(String[] args) { List<Developers>

Adding resources css&js into the page

Reading Time: 1 minute Importing resources files for instance css and js can be really painful, which actually caused me tons of trouble to implement them. I’ve checked out many of examples on the internet, all they say it to create a folder named css for css files and js folder for javascript files in src/main/resources. So I did

Interfaces Versus Abstract Classes

Reading Time: 1 minute While you use an interface to specify the form that something must have, it does not actually provide the implementation for it. In this sense, an interface is a like an abstract class. The abstract class must be extended in exactly the manner that its abstract methods specify. An interface differs from an abstract class

Forms of Inheritance

Reading Time: 4 minutes Timothy Budd, in his book “Understanding Object-Oriented Programming with Java” (Addison-Wesley, 2000), makes the following distinction: The term subtype is used to describe the relationship between types that explicitly recognizes the principle of substitution. That is, a type B is considered to be a subtype of A if two conditions hold. The first is that