Saturday 29 June 2013

Primefaces JSF Spring Web Application

Create java web application using primefaces

      I have been working with some of the web ui templates that makes my life easier for quite some time. I have tried vaadin, GWT kit, groovy and grails, primefaces etc. I would recommend Primefaces as the best option to design your template and pages. It's light weight compared to all other libraries. It has almost all UI components you are looking for. In my opinion, its the best ui component framework that works well with JSF and spring applications. Now it can be integrated with ROO applications also. primeface comes with built-in themes. If you want to apply twitter-bootstrap which is the most widely used themes in coming websites. Just add the maven dependency and enable the appropriate theme in web.xml. Its that simple.

Have a look at the comparison http://www.primefaces.org/whyprimefaces.html

Now we will see how to create a simple jsf-spring-prmeface maven web application.

Frameworks used:
  Spring 3.1.2.RELEASE
  JSF
  Spring security  3.1.0.RELEASE
  Primefaces

1) Since its a maven application, first get the required dependencies.

You can see that I have added bootstrap theme to my web application.

2) Now get the jsf dependencies. Most javaee containers supports built-in support for jsf. I have been working with glassfish server for quite some time. It has built in support for jsf. If you are using glassfish, add the below dependency.


servlet containers like tomcat needs the below dependencies

3) Add spring dependencies

If you want spring security, add the below dependencies too

4) Copy and paste the below contents to web.xml


5) Sample template jsf file
Clean and build your project. That's it!!!.


No comments:

Post a Comment