...
Fonctionnement
| Remarque |
|---|
Faire un shéma |
Exemple de template : template.xhtml
| Bloc de code |
|---|
<!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:t="http://myfaces.apache.org/tomahawk">
<head>
<title><ui:insert name="titre" /></title>
</head>
<body>
<p>
<ui:insert name="contenu" />
</p>
</body>
</html>
|
Exemple de page utilisant le template : ma_page.xhtml
| Bloc de code |
|---|
<!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">
<ui:composition template="/template.xhtml">
<ui:define name="titre">Titre de ma page</ui:define>
<ui:define name="contenu">
Texte, formulaires etc.
</ui:define>
</ui:composition>
</html>
|
Pour aller plus loin...
Possibilité de chaîner les templates
...