So, I'm starting a new project.
It never ceases to amaze me how difficult java web applications are to setup. A lot of it is because of all the different frameworks we get to choose from. This project appears to be going to use Ice Faces (a JSF implementation/extension), Facelets some level of Spring Integration, possibly JPA or Hibernate.
I played around with RichFaces and facelets a few months ago and was able to lean on the JBoss IDE for some of the configuration, but since I'm using Ice Faces this time I don't want all of the extra stuff that comes with the JBoss IDE.
So we get to start from scratch. The documentation is pretty decent on what needs to be added to the web.xml and faces-config.xml to get facelets working correctly. But after that where do you start? I guess the best place is always the beginning so let's code up the index.html page (always a good place to start).
As you know for faces to work you need to be working w/in a faces context so this is a really good places to initialize the faces context let's make a silly little index.jsp page that simply forwards us inside the context:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<jsp:forward page="pages/login.jsf" />
So, that's easy enough. But, with Facelets we don't want to really be writing jsf or jsp pages. Clearly we are forwarding to a jsf page though what gives? We create a url-pattern mapped to a Faces Servlet so any request to our url pattern (*.jsf) get's routed through the faces context. One last thing we need to make sure our faces.DefaultSuffix is linked to *.xhtml pages. So our pages/login.jsf page will land on the pages/login.xhtml page. Remember with JSF it is all about the faces context stay in the context and you will be ok. This is why (IMHO) if you're doing AJAX you really need to use a framework like RichFaces or IceFaces. You're just asking for death by a million cuts to go any other route.
So I got all my xhtml files created the web.xml and faces-config.xml are all tweaked out and guess what the dang thing didn't work. I kept getting this error:
This seems to be a pretty nasty error, all it is really saying is "Hey I somebody is referencing a class I don't know anything about". This is probably java's biggest criticism happening right here on my laptop. I think there are a total of 16 jars I needed to get my very simple page to work here. Don't get me wrong I'm most thankful to the people who wrote them. But man it is sure a pain to be trying to figure out what you need and what you don't.
I actually opted for the shotgun approach. I ended up taking a demo app that comes with Ice Faces and pull out all of the jars from the demo and add them to my project. Not very accurate but it did fix the problem.
That's enough for tonight. I'll let you know how it goes.
By the way I got the ice faces demo apps running here: