Web Application Development using Java Three Tier Architecture
Three tier architecture and component interaction
For this task, we have used the three tier architecture for the e-commerce application which includes a Front tier (responsible for representing the User interface), Middle tier (responsible for implementing the business logic), and the Back end database tier that stores the user inputs available from the front tier and processed by the middle tier. The above three are implemented by, JSF (Java Server Faces), EJB(Enterprise Java Beans) and JPA (Java Persistence Annotation).
For data base or the end tier of the application we used the derby database available in NetBeans IDE. In addition to that, to run the solution we have used the GlassFish 5.0 server integrating with the net beans.
In the app there are multiple objects that interacts with each other in order accomplish the main objective of presenting the application on the browser and store, retrieve and update data in the database.
The main components are, JPA or the Java Persistence API that provides the application required object-relational mapping. This mapping transforms the requests and response objects from the front end to relational database objects and business objects.
Some of the commonly used implementations of JPA can be listed as Hibernate, EclipseLink, as the reference implementation in the JAVA EE application. JPA is a ahelpful tool that runs on the Java Database Connectivity (JDBC) and makes the database operations easy that are achieved through writing JDBC codes and SQL queries. In this method the business objects (data tables) are refereed as entities.
The application is divided in mainly their parts which includes the customer module, products module and the order module. Each of which includes the operations like creating new record in the database tables, viewing the previously inserted data and search for a specific record from the database.
For this application we have used the java EJB and the JPA for the data base connection management. The entities or the objects that are accessed and managed by the EJB (Enterprise Java Beans).
Test instruction for the application
Compiling the deploying the project
As we have used the NetBeans IDE, Derby DB and Glassfish server for the development and testing of the application thus it is deployment of the application on the Glass Fish servers will be suitable for deployment of the application.
Using the NetBeans IDE, we can easily compile and test the web application. In order to deploy the e-commerce website, the Glass Fish server in the NetBeans, after importing the project the application directory will be deployed after the Run command is executed.
In this way, the GlassFish server will be started and directory files are deployed on the server. The web application directory is loaded on the server using directory deployment before the pages are rendered in the web browser (first the index page). The Directory deployment is the way in which an application is deployed to the server using the structured directory defined for the application rather than using a WAR (web archive file).
Another technique of deployment is WAR file deployment. In this way the WAR ( it is a Java Archive file or JAR consisting the packaged web application). file generated in the debugging process is deployed on the server. This application archive composed of the EJB logic, XHTML pages as a front end of the application as well other files that contains the business logic of the web application. In addition to the WAR file contains a runtime deployment descriptor under the WEB-INF folder of the (XML file). This XML file contains instruction that describes the way of execution of the application to the server.
Inputs and expected outputs
After the execution of WAR file on the Glass Fish server, the index page will be produced which will prompt the different options to create view and search for the database table items from the java Derby database.
For the create operations the applications will present a form that needs to be filled by the user and upon pressing the submit button on the page it will be added to the respective tables. After each insertion the pages will show the last inserted data to the table.
The developed application has covered the creation, view and searching of the entries for the customer’s games and orders for the e-commerce business. It is important to manage ad deploy the application after the database for this application is attached to the local database server which is required to store the user provided data.