JSF Maven Hello World
To start with JSF framework it’s important to understand how to set up simple project which will print some value on web page then slowly move on other topic. In this demo you will see how to set JSF project with one web page where we will invoke managed bean on server side to retrieve data and print its out put on web page.
- Eclipse Luna (You can use any version) and install JBoss Tools plug-in into it so that you can create maven project directly from Eclipse.
- Tomcat server (I will use version 7)
- Create maven project name: JSFMavenHelloWorld in eclipse if you are not sure how to create it please follow this tutorial. Below is final project structure:
- Managed bean JSFHelloWorld.java:
- To run this project you can configure tomcat with eclipse using this tutorial. You will see below output:
- As you see in web.xml we have done servlet mapping for many extension you could any of them to view the output (http://localhost:8080/JSFMavenHelloWorld/JSFHelloWorld.jsf OR http://localhost:8080/JSFMavenHelloWorld/JSFHelloWorld.faces OR http://localhost:8080/JSFMavenHelloWorld/JSFHelloWorld.xhtml
- For more information visit JSF documentation here
Download Project: JSFMavenHelloWorld