The Employee class has two attributes - name and department, we also have two lists of employees - the permanent employees and the contractors. We have a method called getRecruitmentDecider that returns a Decider object. The Decider implementation returns true if the employee works for the recruitment department, and it returns false otherwise.

Next, let us create a DepartmentComparator to compare Employee objects:

The merge tag takes two or more lists as parameters. We need to give the merge an id so that we can reuse it later. In this example, we supply employees and contractors as parameters to the merge tag. We then use the "allemployees" id to iterate through the merged list and print the employee details.

Right click on the project name and click Export > WAR File to create a War file. Then deploy this WAR in the Tomcat's webapps directory. Finally, start Tomcat server and try to access URL http://localhost:8080/HelloWorldStruts2/employee.action. This will give you following screen: