Looking for a JSF Tutorial or an easy to go JSF example? Read on…
What you need ?
Tomcat server . You can download from here: http://tomcat.apache.org/download-55.cgi
And 20 minutes of your time…
What we will achieve ?
Your first JSF program. Nothing fancy. No bells and whistles- just a plain vanilla JSF program which will say hello to you.
Note: If you are looking for a JSF example to show you Backing Beans or JSF Navigation- then this is probably not for you. This is just to give you started real quick on JSF. Other good things about JSF will follow later.
That you are running your tomcat server on port 8080.
This example was tested on windows XP platform- but should really work anywhere.
Step1 ownload the tutoral from here.
Step 2: Unzip the file under your webapps folder under Tomcat installation
Step 3: Copy this URL to your favourite browser
This specified the path for teh Faces-config file. the heart of a JSF application
This is to load the Faces Servlet before anything else.
<load-on-startup> 1 </load-on-startup>
This will map any URL ending with *.rn to be routed to the Faces Servlet
2) Faces-config.xml: Deliberately kept empty. Just a place holder for you to do greater things later on.
3) hellojsf.jsp : A very simple JSP.
4) hellojsf.txt: This is a simple text file. which can be loaded just like any other web resource.
I have included this as a troubleshooting aid- if you are unable to load the JSP try loading this instead. This bypasses the whole faces servlet so has a better chance of being loaded
What’s Next ?
This JSF tutorial was just to get your feet wet .Next logical step would be to get introduced to JSF Navigation and Backing Beans. I will be posting a tutorial on that soon.
If this example doesnt work for some reason – please leave a note and I will try to assist. Also see my other posts on troubleshooting http://www.rajivnarula.com/blog/tags/troubleshooting/