webtier@glassfish.java.net

Facelets templating and JSF

From: <webtier_at_javadesktop.org>
Date: Wed, 09 Jun 2010 02:58:10 PDT

I have a Facelets template that looks like this (the CDATA tag is just there to make it readable on the forum):

---
<![CDATA[
<?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:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core">
	<f:view>
		<head>
			<meta http-equiv="cache-control" content="no-cache" />
			<meta http-equiv="pragma" content="no-cache" />
			<title><ui:insert name="title">Default Title</ui:insert></title>
		</head>
		<body>
			<div id="header">
				<ui:insert name="header">
					<ui:include src="header.xhtml" />
				</ui:insert>
			</div>
			<div id="navigation">
				<ui:insert name="navigation">
					<ui:include src="navigation.xhtml" />
				</ui:insert>
			</div>
			<div id="breadcrumbbar">
				<ui:insert name="breadCrumbList" />
			</div>
			<div id="center">
				<ui:insert name="center">
					<ui:include src="center.xhtml" />
				</ui:insert>
			</div>
			<div id="footer">
				<ui:insert name="footer">
					<ui:include src="footer.xhtml" />
				</ui:insert>
			</div>
		</body>
	</f:view>
</html>
]]>
---
I have placed the body tag in the template. Several pages use this template.
Now the questions:
1) Is it possible to add something to the onLoad parameter of the body tag from a jsf page that uses this template without modifying the template? What I need is to have some pages (but not all) that uses this template to call a Javascript function when the page has loaded.
2) Is it possible to add content to the head tag from a jsf page that uses this template?
If 1) or 2) this is not possible what would be the best template structure to archieve this?
I am using JSF 1.2 and Facelets 1.1.14.
I would appreciate any advice or answers you may have.
Thanks
[Message sent by forum member 'jkchristensen']
http://forums.java.net/jive/thread.jspa?messageID=473501