Currently I have two pages and one template:
myapp (war)
|-myTemplate.xhtml //yes i know, the template is in the main folder :(
|-page1.xhtml
|-folder
|--page2.xhtml
page1 and page2 has the same structure
So, when i access to the page1 the jsf template renders pretty well, but, when i tried look at the page2, everything looks distorted. The template is not working in that case.
web.xml has the 'url pattern' in this way:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
EDIT: the page is pretty simple, the template is much more elaborated
page1.xhtml and page2.xhtml :
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core"
template="./mainTemplate.xhtml">
<ui:define name="content">
<h1>
<h:outputText value="#{i18n['cc.title']}"/>
</h1>
<h:form id="form">
<!-- outputLabels, inputTexts... -->
</h:form>
</ui:define>
</ui:composition>
template.xhtml
<?xml version='1.0' encoding='iso-8859-1' ?>
<!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://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<f:loadBundle var="i18n" basename="co.gov.rnec.srcw.languages.Mensajes"/>
<f:loadBundle var="i18nDefuncion" basename="co.gov.rnec.srcw.languages.MensajesDefuncion"/>
<f:loadBundle var="i18nMatrimonio" basename="co.gov.rnec.srcw.languages.MensajesMatrimonio"/>
<f:loadBundle var="i18nNacimiento" basename="co.gov.rnec.srcw.languages.MensajesNacimiento"/>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles/styles_ani.css" rel="stylesheet" type="text/css"/>
<link href="styles/form_styles.css" rel="stylesheet" type="text/css"/>
<link href="styles/menu.css" rel="stylesheet" type="text/css"/>
<title>#{i18n['srcw.titulo']}</title>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript" src="js/general/general.js"></script>
<script type="text/javascript" src="js/general/fechas.js"></script>
<script type="text/javascript" src="js/general/frmvalidaciones.js"/>
</h:head>
<h:body onload="getHora();" >
<div class="container">
<div class="header">
<div class="floatleft">
<a href="#"><img src="images/logorneclittle.jpg" alt="Registraduria Nacional del Estado Civil" name="Logo" width="145" height="90" id="Insert_logo" style="background-color: #8090AB; display:block;" /></a>
</div>
<div class="floatleft">
<p class="size50"> </p>
<p class="ani-verdanagriscatorce size50"><h:outputText value="#{i18n['main.titulo.titulo']}" escape="false"/></p>
<p class="ani-verdanaverdedieciseis size50"><h:outputText value="#{i18n['main.titulo.subtitulo1']}" escape="false"/></p>
<p class="ani-verdanagriscatorce size50"><h:outputText value="#{i18n['main.titulo.subtitulo2']}" escape="false"/></p>
<div class="floatleft"><p><a href="logout.jsp">#{i18n["main.titulo.salida"]}</a></p></div>
<div class="floatleft"><p><a href="cambiaclave.jsp">#{i18n["main.titulo.cambiarclave"]}</a></p></div>
</div>
<div class="floatright ani-normalgrisdieztitulo">
<p class="size30"> </p>
<p class="size30"> </p>
<p class="size30"><h:outputText value="#{i18n['main.label.version']}: #{i18n['srcw.version']}" escape="false"/></p>
<p class="size30">#{i18n["main.label.usuario"]}: <h:outputText value="#{sessionScope.nombrecompleto} - #{sessionScope.login}" styleClass="capitalized" /></p>
<p class="size30">#{i18n["main.label.cargo"]}: <h:outputText value="#{sessionScope.grupo}" styleClass="capitalized" /></p>
<p class="size30" id="reloj"></p>
</div>
<br class="clearfloat"/>
<div id="menu" class="menu">
<h:outputText escape="false" value="#{sessionScope.menuAplicacion}"/>
</div>
<!-- end .header -->
</div>
<div id="formulario" class="content">
<!-- a form -->
</div>
</div>
</h:body>
</html>
As you can see page1 has the same structure as page2 (well, obviously i modified the template path accordingly) and there is no message error. Just when access to page2 a malformed page.