April 2004
Intermediate to advanced
606 pages
20h 4m
English
Static includes for JSP pages containing JSF component actions work the same as for regular JSP pages. I use static includes to piece together the sample application, because the main reason for splitting it up in the first place is maintainability. All filenames are known at development time and using static includes avoid the runtime penalty and other issues, as described earlier.
Example 12-1 shows the top level JSP page, i.e., the one the pulls in all the other ones.
<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://mycompany.com/jsftaglib" prefix="my" %>
<html>
<head>
<title>Expense Reports</title>
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/style.css">
</head>
<body bgcolor="white">
<f:view locale="#{userProfile.locale}">
<f:loadBundle basename="labels" var="labels" />
<table width="95%" align="center">
<tr>
<td colspan="2">
<!-- Title -->
<h:outputText value="#{labels.applicationTitle}"
styleClass="title" />
</td>
</tr>
<tr>
<td colspan="2" class="toolbar">
<!-- Menu -->
<h:form>
<%@ include file="menuArea.jspf" %>
</h:form>
</td>
</tr>
<tr>
<td valign="top" width="60%">
<!-- Reports -->
<h:form>
<%@ include file="reportsArea.jspf" %>
</h:form> </td> <td valign="top"> ...Read now
Unlock full access