我正在使用 PrimeFaces 3.4.1、MyFaces 2.0.7、Websphere Application Server 7。
我正在使用p:tabView
带有 3 个选项卡的组件。当我在应用程序中更改语言时first tab
工作正常,没有任何错误。但是如果我去second or third tab
-> 更改语言 -> 然后导航到任何一个非活动选项卡。我得到以下异常。
Caused by: java.io.FileNotFoundException: Facelet /.xhtml?REQUIRED=false not found at: file:/opt/IBM/WebSphere/AppServer/profiles/mblade140/installedApps/mblade140/ldapmanager-application-ear.ear/ldapmanager-application-web.war/.xhtml?REQUIRED=false
[08.02.13 12:55:42:349 CET] 00000090 SystemErr R at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory._createFacelet(DefaultFaceletFactory.java:286)
以下是我为p:tabView
组件编写代码的方式
<h:form id="headerForm" prependId="false">
<h:inputHidden id="activeTabIndexId" value="#{AppUserManagementBean.activeTabIndex}" />
<p:remoteCommand update="tabView:fieldAppUserMgmt,tabView:filterApps,tabView:filterRoles,tabView:panel_grid_newuser"
name="onTabChange"
process="activeTabIndexId,@this"
actionListener="#{AppUserManagementBean.onTabChanged}" >
<f:param name="REQUIRED" value="false"/>
</p:remoteCommand>
<p:tabView id="tabView" dynamic="true" cache="true" activeIndex="#{AppUserManagementBean.activeTabIndex}"
onTabChange="document.getElementById('activeTabIndexId').value = index;onTabChange();">
<p:tab id="userManagementTab" title="#{msgs.UserManagement_Title}">
<ui:include src="UserManagement.xhtml" />
</p:tab>
<p:tab id="applicationUserManagementTab"
title="#{msgs.AppUserMgmt_Title}">
<ui:include src="AppUserManagement.xhtml" />
</p:tab>
<p:tab id="userGroupManagementTab"
title="#{msgs.UserGroupMgmt_Title}">
<ui:include src="UserGroupManagement.xhtml" />
</p:tab>
</p:tabView>
</h:form>
这是我为更改支持 bean 中的语言而编写的代码。更改语言时调用此方法p:selectOneMenu
public void setLocale(String selectedLocale) {
System.out.println("Changing locale to "+selectedLocale);
this.locale = selectedLocale;
for (Map.Entry<String, Locale> entry : countryMap.entrySet()) {
if (entry.getValue().toString().equals(selectedLocale)) {
FacesContext.getCurrentInstance().getViewRoot()
.setLocale((Locale) entry.getValue());
}
}
}
我在这里做错了什么?有人可以阐明这一点。