2012-04-26 73 views
-2

从一个页面导航到另一个页面时,页面不会更新。 谁能告诉我为什么?Icefaces/JSF页面不更新<TITLE>

的设置:

页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> 

页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> 

页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> 

导航页c.jsf做这样:

FacesContext.getCurrentInstance().getViewRoot().setViewId("c.xhtml"); 

的问题是,“标题”元素不更新到新标题。它在保存来自c.xhtml之前的第一页的值。 看来,整个“HEAD”元素没有加载新页面。 建议?

谢谢

回答

0

我们现在已经改变了我们导航到页面的方式。 现在我们正在使用:

FacesContext.getCurrentInstance().getExternalContext().redirect(getViewId());