There is this strange situation I'm fighting on. I have 3 pages, les call them A, B and C. Every page has its own Managed Bean in request scope: MB1, MB2 and MB3, respectively. When I enter on A, MB1 is created. From A, I call a window.showModalDialog to open B and every time B its opened MB2 is created. The strangeness starts when I call page C from B with window.showModalDialog, and MB3 gets created once. This behavior is driving me insane, because I have done things like this and its the first time this is happening.
I must also say that MB1 and MB2 have the @KeepAlive annotation (similar to use the a4j:keepAlive
tag component, and MB3 is a clean managed bean.
I'm open to any ideas to solve the problem. I'm currently working with JSF 1.2, RichFaces 3.3.3 and JBoss EAP 5.1.
Thanks for your time and sorry for my bad english!
EDIT 1: The source code for pages A, B and C:
page A:
<!-- The js function which calls page B -->
<script type="text/javascript">
function buscaDeposito() {
var blnResultado = false;
var sUrl = 'pageB.jsf';
var oDatos = new Object();
var args = 'dialogHeight: 450px; dialogWidth: 700px; edge: Raised; center: Yes; help: No; resizable: No; status: No';
if (window.showModalDialog(sUrl, oDatos, args)) {
blnResultado = true;
document.getElementById('frmFormaCobroLiqDocCartera:txtNroDeposito').value = oDatos.ReturnValue;
}
return blnResultado;
}
</script>
<!-- HTML/JSF fragment of page A -->
<table class="tabla" width="100%">
<tr>
<td style="width: 25%; text-align: right">
<h:outputText>Nro. de depósito no identificado</h:outputText>
</td>
<td style="width: 20%">
<h:inputText id="txtNroDeposito" styleClass="inputText" style="width: 100%"
readonly="true"
value="#{formaCobroLiqDocCartera.numeroDepositoNoIdentificado}" />
</td>
<td>
<a4j:commandLink id="lnkBuscaDNIDeposito"
onclick="if (!buscaDeposito()) return false;"
action="#{formaCobroLiqDocCartera.cargaDatosDeposito}"
reRender="pnlDeposito" limitToList="true">
<h:graphicImage value="/Resource/iconos/buscar-con-ayuda.png"
styleClass="pic" title="Buscar" />
</a4j:commandLink>
</td>
</tr>
</table>
page B:
<script type="text/javascript">
window.returnValue = false;
// The js function which calls pageC
function veDetalleDeposito() {
//The function depositoSeleccionado checks if at least one
//radio button has been selected in the dataTable.
if (!depositoSeleccionado()) {
alert('Debe seleccionar un depósito.');
} else {
var sUrl = 'pageC.jsf';
var oDatos = new Object();
var args = 'dialogHeight: 280px; dialogWidth: 400px; edge: Raised; center: Yes; help: No; resizable: No; status: No';
window.showModalDialog(sUrl, oDatos, args);
}
}
</script>
<!-- The call to pageC in the oncomplete javascript because I must set a session
variable with the value of the selected row. -->
<a4j:commandLink id="lnkVeDetalle" oncomplete="veDetalleDeposito()">
<h:graphicImage value="/Resource/iconos/visualizar-registro.png" styleClass="pic"
title="Ver detalle de depósito" />
</a4j:commandLink>
<rich:dataTable id="dtDepositos" width="100%" headerClass="cabeceraDataTable"
binding="#{listaDepositoNoIdentificado.hdtDepositos}" rows="15"
value="#{listaDepositoNoIdentificado.lstDepositos}" var="deposito">
<rich:column width="5%" style="text-align:center">
<f:facet name="header">
<h:outputText value="Seleccione" />
</f:facet>
<h:selectOneRadio onclick="dataTableSelectOneRadio(this)"
valueChangeListener="#{listaDepositoNoIdentificado.setSelectedItem}">
<f:selectItem itemValue="null" />
</h:selectOneRadio>
</rich:column>
<!-- more columns here... -->
</rich:dataTable>
page C (a simple jsf page which does nothing):
<h:form style="font-family: sans-serif;">
<h2 class="tituloPagina">Detalle del Depósito No Identificado</h2>
<fieldset>
<legend class="legenda">Detalle del Depósito No Identificado</legend>
<table>
<tr>
<td>Tipo:</td>
<td>
<h:outputText value="#{detalleDeposito.deposito.tipo}" />
</td>
</tr>
<tr>
<td>Número:</td>
<td>
<h:outputText value="#{detalleDeposito.deposito.codigoDni}" />
</td>
</tr>
<!-- more data to present to the users. -->
</table>
</fieldset>
</h:form>
faces-config.xml:
<managed-bean>
<managed-bean-name>formaCobroLiqDocCartera</managed-bean-name>
<managed-bean-class>com.abaco.presentacion.managedbean.PFormaCobroLiqDocCartera</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>listaDepositoNoIdentificado</managed-bean-name>
<managed-bean-class>com.abaco.presentacion.managedbean.PListaDepositoNoIdentificado</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>detalleDeposito</managed-bean-name>
<managed-bean-class>com.abaco.presentacion.managedbean.PDetalleDeposito</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
If you need anything else to check the problem, just ask for it and I'll post it as soon as I can. By te way, sorry for not write anything in the last 8 hours I was sleeping =(.
EDIT 2: I have reviewed this issue in other web explorers, and the result was that the problem it only appears in the spiteful IE8 :(. Any ideas what to do to prevent this odd behavior?