no

Create a simple JavaEE web app with maven, glassfish and postgresql

This tutorial creates a simple javaee6 project using eclipse with maven. The application has 1 xhtml page that has a create button, and as y...

This tutorial creates a simple javaee6 project using eclipse with maven. The application has 1 xhtml page that has a create button, and as you guest it when press will create an Employee record in the database. We use postgresql as the database and glassfish as the container. The models are automatically created using @Entity, @Table annotation.

Important parts of the code:
1.) Eclipse-jee-juno with maven plugin.
  a.) Create a new maven project using quickstart archetype from org.apache.
  b.) You can delete the App.java file.

The sequence can be random, but here is how I add files to the project:

2.) First we add a new source folder src/main/resources and add:
  a.) messages.properties for the localization
  b.) META-INF/ehcache.xml - java based cache
  c.) META-INF/persistence.xml - for hibernate

3.) Add new folder src/main/webapp and inside it add:
  a.) index.xhtml
  b.) WEB-INF/beans.xml - to enable javaee6
  c.) WEB-INF/faces-config.xml
  d.) WEB-INFweb.xml

4.) Your java files should be in src/main/java.

5.) You need to create connection pool and connection data source: http://czetsuya-tech.blogspot.com/2012/05/how-to-create-connection-pool-for.html

6.) Download the entire code here :-)
https://code.google.com/p/czetsuya/source/browse/#svn%2Ftrunk%2Fjavaee6-demo

Related

javaee 6235588102968046707

Post a Comment Default Comments

item