posted 15 years ago
1. Create a layout.jspx page by including following code.
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:ui="http://java.sun.com/jsf/facelets">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="default.css" rel="stylesheet" type="text/css" />
<link href="cssLayout.css" rel="stylesheet" type="text/css" />
<title>Facelets Template</title>
</head>
<body>
<div id="top">
<ui:insert name="top">Header</ui:insert>
</div>
<div id="content">
<ui:insert name="content">Content</ui:insert>
</div>
<div id="bottom">
<ui:insert name="bottom">Footer</ui:insert>
</div>
</body>
</html>
</jsp:root>
2. Create a new JSP Page and add the following taglibraries in addition to existing core and html tag libraries.
<jsp:root xmlns:ice= “http://www.icesoft.com/icefaces/component”
xmlns:ui= “http://java.sun.com/jsf/facelets” >
</jsp:root>
3. Use the above layout file in JSP Page using <ui:composition> component.
<ui:composition template=layout.jspx"></ui:composition>
4. Change the content part of main page using <ui:define> component. Place this component inside <ui:composition>.
<ui:composition template="layout.jspx">
<ui:define name="content">
<f:view>
<ice:form>
<ice:outputText value=”welcome to Facelets”/>
</ice:form>
</f:view>
</ui:define>
</ui:composition>
5. Include following code in faces-config.xml
<application>
<view-handler>
com.icesoft.faces.facelets.D2DFaceletViewHandler
</view-handler>
</application>
6. Add Dependency for following jars
1. el-ri.jar
2. el-api.jar
3. icefaces-facelets.jar
4. servlet-api.jar