The J2EE Architecture allows the programmers to divide their work into two major categories:
Presentation Logic consists of all the program (JSP and Servlets), images and html files that are used to interact with the client. These files are archived into .war file. These files are installed on the web server and these interacts with the users.
These are EJB applications which implements the business logic of the system and are archived into .jar file. Business logic runs on the application server.
These two types of archives are bundled into complete J2EE applications, and delivered as Enterprise Archive (EAR) file.
Let's took an example of form processing. In
this example J2EE application could have and HTML form, which prompts
the user to input the data, a servlet to receive the data from the
form and process it, and also an Enterprise Bean to store the data in
a database. In this example the HTML form and servlet are archived in
a WAR file, and the Enterprise Java Bean is archived into JAR file.
These two archive files (WAR and JAR) both are added to the EAR file,
which is finally deployed on the server.
Recommend the tutorial