【发布时间】:2014-03-20 07:44:30
【问题描述】:
让我们从我的问题开始:
我有两个页面:主要页面和职业页面。
两者都有相同的模板:<ui:composition template="/common/decorators/template.xhtml">
模板.xhtml
.
.
.
<app:metaHeader />
</h:head>
<h:body>
<app:status/>
<ui:debug hotkey="d" rendered="#{initParam['facelets.DEVELOPMENT']}" />
<div id="geral">
<div id="header">
<app:header />
</div>
<p:messages id="messages" showDetail="false" autoUpdate="true" closable="true" />
<ui:insert name="body" />
</div>
</h:body>
</html>
<app:header /> 是:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:acegijsf="http://sourceforge.net/projects/jsf-comp/acegijsf"
xmlns:app="http://cni.org.br/tags"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:p="http://primefaces.org/ui" xml:lang="pt" lang="pt">
<div id="header">
<div class="content">
<h:form>
<div>
<p:outputPanel>
<label>You are in:</label>
<h:selectOneMenu id="cities" value="#{bean.selectedCity}"
converter="omnifaces.SelectItemsConverter">
<f:selectItems id="selectedCity" value="#{bean.cityList}"
var="city" itemLabel="#{city.name}" itemValue="#{city}" />
<p:ajax event="change" listener="#{bean.citySession}"
update="?????????" />
</h:selectOneMenu>
</p:outputPanel>
</div>
</h:form>
</div>
</div>
所以,当我在标题处选择一个城市时,我需要更新整个 main.xhtml 页面,但只需要更新professional.xhtml 中的几个组件。
我尝试过使用
<p:ajax event="change" listener="#{bean.citySession}" upate=":componentsIwant" />
<p:ajax event="change" listener="#{bean.citySession}" upate=":professionForm:componentsIwant" />
<p:ajax event="change" listener="#{bean.citySession}" upate=":general:professionForm:componentsIwant" />
但是main.xhtml(我选择要详细说明的专业的页面)上不存在componentsIwant,所以我得到了:
找不到从“j_id18836674_3d6516fd:cities”引用的表达式“:componentsIwant”的组件。
有什么办法可以解决吗?
附:我不能更改模板,因为这是公司的标准。
【问题讨论】:
标签: java jsf primefaces include