ui:include does not working
shmu80 Mar 3, 2015 5:17 AMHi,
The ui:include is not working in my project. I was struggling with this since a week ago, and it just a starting of my project. Hopefully somebody may give me some advice.
Thanks a lot.
Below is my project file organization
Source code for main.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="./../resources/css/default.css" rel="stylesheet" type="text/css" />
<link href="./../resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
<title>Testing</title>
</h:head>
<h:body>
<h:outputStylesheet library="css" name="application.css" />
<div id="top" class="top">
<ui:insert name="top">Top</ui:insert>
<ui:include src="templates/template.xhtml" />
</div>
<div class="left-menu">
<ui:include src="templates/include/sideNavi.xhtml" />
</div>
<div id="content" class="center_content">
<ui:insert name="content">Content</ui:insert>
</div>
</h:body>
</html>
sideNavi.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich" xmlns:c="http://java.sun.com/jsp/jstl/core">
<rich:panelMenu style="width:200px" itemMode="ajax" groupMode="ajax"
groupExpandedLeftIcon="triangleUp"
groupCollapsedLeftIcon="triangleDown"
topGroupExpandedRightIcon="chevronUp"
topGroupCollapsedRightIcon="chevronDown" itemLeftIcon="disc"
itemChangeListener="#{nav.updateCurrent}">
<rich:panelMenuGroup label="Group 1">
<rich:panelMenuItem label="Item 1.1" name="Item_1_1" />
<rich:panelMenuItem label="Item 1.2" name="Item_1_2" />
<rich:panelMenuItem label="Item 1.3" name="Item_1_3" />
</rich:panelMenuGroup>
</rich:panelMenu>
</ui:composition>
When I run the project in tomcat 7, the display is same as below. While I view the source, the source code is able to refer to the file properly.
View Source for main.xhtml
View source, click from the link templates/include/sideNavi.xhtml