When navigating from one page to another the doesn't update in my pages. Can anyone tell me why?
The setup:
Page a.xhtml:
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<ui:insert name="stuffToInclude">
</ui:insert>
</h:head>
<h:body>
....
</h:body>
Page b.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<ui:composition template="/a.xhtml">
<ui:define name="stuffToInclude">
<meta name="description" content="pierre" />
<title>
<ui:insert name="title"/>
</title>
</ui:define>
</h:head>
Page c.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</h:head>
<h:body>
<ui:composition template="/b.xhtml">
<ui:define name="title">
<ice:outputText id="title" nospan="true" value="C Title" />
</ui:define>
.....
</h:body>
</html>
Navigation to page c.jsf is done this way:
FacesContext.getCurrentInstance().getViewRoot().setViewId("c.xhtml");
The problem is that the "TITLE" element does not update to the new title. It keeps the value from the first page that I was on before going to c.xhtml. It seems that the whole "HEAD" element isn't loaded for the new page. Suggestions?
thanks
We have now change the way we navigate to pages. Now we're using:
FacesContext.getCurrentInstance().getExternalContext().redirect(getViewId());