...
- Start the eclipse wizard and right click on the Project Explorer and click on the New -> Dynamic Web Project
- Enter the project name as EmployeeWEB and click on the Next button.
- On the New Dynamic Web Project wizard, check on the Project Facet checkboxes and select the version values as below screen shot, and click on the Next button.
- On the Web Module wizard, make sure that Generate Deployment Descriptor is checked as below and click on the Next button.
- On the Geronimo Deployment Plan wizard, provide the moduleId values as below screen shot and click on the Next button.
- On the JSF Capabilities wizard, check the second radio button and click on the New button by the side of the combo box. This will open Create JSF Implementation Library wizard.
- Provide the Library Name as MyJSFLibrary and add the following jars by clicking on the Add button. Finally, click on the Finish button.
- <geronimo_home>\repository\commons-beanutils\commons-beanutils\1.67.10\commons-beanutils-1.67.10.jar
- <geronimo_home>\repository\commons-collections\commons-collections\3.12\commons-collections-3.12.jar
- <geronimo_home>\repository\commons-digester\commons-digester\1.8\commons-digester-1.8.jar
- <geronimo_home>\repository\commons-logging\commons-logging\1.0.4\commons-logging-1.0.4.jar
- <geronimo_home>\repository\org\apache\myfaces\core\myfaces-api\1.2.26\myfaces-api-1.2.2.jar
- <geronimo_home>\repository\org\apache\myfaces\core\myfaces-impl\1.2.26\myfaces-impl-1.2.2.jar
- Now, on the JSF Capabilities wizard, add the URL Mapping Patterns as *.jsf and click on the Finish button.
- This will create EmployeeWEB application in the Project Explorer as below screen shot.
- Right click on the WEB-INF folder and navigate to New -> Folder and create a folder by name tld as given in the screen shot below.
- Copy
myfaces_core.tld
andmyfaces-html.tld
files into the tld folder. These*.tld
files are available in themyfaces-apiimpl-1.2.26.jar
file. - We are going to use JPA to connect to EmployeeDB database created in the embedded Derby database. JPA uses
persistence.xml
file for configuration. Create a META-INF folder in the EmployeeWEB -> build -> classes folder in the Project Explorer. The contents of thepersistence.xml
are as follows.
Code Block XML XML borderStyle solid title persistence.xml <?xml version="1.0" encoding="UTF-8" ?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="Employee" transaction-type="JTA"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <non-jta-data-source>EmployeeDS</non-jta-data-source> </persistence-unit> </persistence>
...