I'm following a sample code from a book about jsf. Different from the book, I'm using jboss 4.2.3.GA and netbeans 6.8 (the book sample uses tomcat and eclipse).
Everything works fine but there's one clause on the faces-config.xml that I have to comment, otherwise the code doesn't run:
When I uncomment the code above, I got the following error:
javax.servlet.ServletException: Error Parsing /form.jsp: Error Traced[line: 1] The markup in the document preceding the root element must be well-formed.
I had to remove jsf-api.jar and jsf-impl.jar from the netbeans project becouse they are already present in C:\jboss-4.2.3.GA\server\default\deploy\jboss-web.deployer\jsf-libs directory. If I don't, I got this error:
exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.jbossjsfconfigurelistener
Could someone explain me why these error occurs? And what is the purpose of the <view-handler> tag? The book doesn't explain that.
The first error is self-describing. form.jsp is not well-formed. It has an error on line 1.
The second error is because your application server is already providing the needed jars.
If you are using maven to build your application you could change the dependency scope to provided for these jars.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
I'm not sure about the XML file error, since they look correct. But you might want to try putting the comment INSIDE the faces-config (root) element, instead of in front of it. In other words, right before the "managed-bean" element. XML can be fastidious sometimes.