I am using JSF 2 and RichFaces in Tomcat. I am a beginner and trying out a page I found here, but the page is just blank (contents not being rendered). I try to add the Facelets 1.1 libraries and the page is rendered without a problem. However, I read somewhere that with JSF 2, Facelets libraries are not necessary as they are included by default. Also, when I add the Facelets libraries, other pages are being affected where I start getting a message like "library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: head" for a page that was working ok without the libraries. I also included the following libraries in my /WEB-INF/lib directory:
- richfaces-api-3.3.3.Final.jar
- richfaces-impl-3.3.3.Final.jar
- richfaces-impl-jsf2-3.3.3.Final.jar
- richfaces-ui-3.3.3.Final.jar
- jstl.jar
- standard.jar
For simplicity, my code is here (some sections removed so that it is not too long).
NB:When i insert some plain text inside h:form or h:panelGrid, it is rendered without a problem.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style>
.cols {
vertical-align: top;
}
</style>
<h:form id="form">
<h:panelGrid columns="2" columnClasses="cols,cols" width="400">
<rich:panelMenu style="width:200px" mode="ajax"
iconExpandedGroup="disc" iconCollapsedGroup="disc"
iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
iconCollapsedTopGroup="chevronDown">
<rich:panelMenuGroup label="Group 1">
<rich:panelMenuItem label="Item 1.1"
action="#{panelMenu.updateCurrent}">
<f:param name="current" value="Item 1.1" />
</rich:panelMenuItem>
<rich:panelMenuItem label="Item 1.2"
action="#{panelMenu.updateCurrent}">
<f:param name="current" value="Item 1.2" />
</rich:panelMenuItem>
<rich:panelMenuItem label="Item 1.3"
action="#{panelMenu.updateCurrent}">
<f:param name="current" value="Item 1.3" />
</rich:panelMenuItem>
</rich:panelMenuGroup>
</rich:panelMenu>
<rich:panel bodyClass="rich-laguna-panel-no-header">
<a4j:outputPanel ajaxRendered="true">
<h:outputText value="#{panelMenu.current} selected" id="current" />
</a4j:outputPanel>
</rich:panel>
</h:panelGrid>
</h:form>