Consume data within a Web Application
Introduction
This web application demonstrates the basic CRUD operations a particular database user can perform on a database.Â
Prerequisites
- Java Development Kit / JRE version 1.6.* or 1.7.*
- Apache Ant 1.7.0 or later
Configurations
User needs to create a database in mysql. After creating the mysql database, it is required to execute the customer.sql script which is available in the resource directory of the project to create the tables and insert data to work with the application. Go to the web.xml file located in WEB-INF folder in the projectUser need to specify the backend database configurations in the web.xml file. User need to specify the driverClass, dbUrl(JDBC URL to connect to the database), dbUser (Username of the database user) and dbPassword (Password of the database user). For example,
<web-app> <display-name>StratosLive RSS Sample</display-name> <context-param> <param-name>driverClass</param-name> <param-value>com.mysql.jdbc.Driver</param-value> </context-param> <context-param> <param-name>dbUrl</param-name> <param-value>jdbc:mysql://localhost:3306/test</param-value> </context-param> <context-param> <param-name>dbUser</param-name> <param-value>root</param-value> </context-param> <context-param> <param-name>dbPassword</param-name> <param-value>root</param-value> </context-param> </web-app>
Building the Sample
mvn clean install
Executing the Sample
Deploy the WAR file created in the previous step, in your preferred Application Server and try the functionalities.