Mojarra 2.1.6 Webアプリケーションに問題があります。マネージドBeanを使用して開発して@ViewScoped
おり、各Beanはxhtmlページに添付されています。このページはいくつかのビューパラメータを受け取り、そのようにBeanを初期化した後:
<ui:composition 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:p="http://primefaces.org/ui"
template="/templates/general_template.xhtml">
<ui:define name="metadata">
<f:metadata>
<f:viewParam id="user" name="user"
value="#{navegableUserData._ParamUser}" />
<f:viewParam id="NavIndex" name="NavIndex"
value="#{navegableUserData._QueueIndex}" />
<f:event type="preRenderView"
listener="#{navegableUserData.initialize}" />
</f:metadata>
<h:message for="user" />
</ui:define>
<ui:define name="general_content">
<p:outputPanel autoUpdate="false" id="Datos_Loged" name="Datos_Loged"
layout="block">
<h:form id="SystemUserForm">
<ui:include
src="/system/manage_user/content/edit_user/system_user_data/system_user.xhtml">
<ui:param name="manager" value="#{navegableUserData}" />
</ui:include>
</h:form>
</p:outputPanel>
</ui:define>
ご覧のとおり、ページは次のような一般的なテンプレートにネストされています。
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html 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://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:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
<h:head>
<meta http-equiv="Pragma" CONTENT="no-cache"></meta>
<meta http-equiv="cache-control" content="no-cache"></meta>
<meta http-equiv="Expires" CONTENT="-1"></meta>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-15" />
<h:outputStylesheet library="css" name="prime_styles.css" />
<h:outputScript library="js" name="prime_translations.js" />
</h:head>
<h:body>
<ui:insert name="metadata" />
<o:importConstants
type="com.company.system.view.beans.NavigationResults" />
<!-- More stuff -->
Primefacesテーブルフィルタリングなどのajaxリクエストを行うと問題が発生します。私のバッキングBeanは再度作成されていませんが、<f:event type="preRenderView" listener="#{navegableUserData.initialize}" />
再度呼び出されています。
ビューパラメータに基づいてデータの読み込みを行っており、ページが最初にレンダリングされたときにのみそのメソッドを実行する必要があります。タグの使用には細心の注意を払ってい<c:xxx>
ますが、一般的なテンプレートでのみ使用し、ビューBeanのプロパティがタグに添付されていないため、問題はないと思います。また、すべてのページでこの問題が発生しているため、特定のバッキングBeanの問題ではないと思います。