I'm having some trouble where <f:event type="preRenderView" listener="#{decryptionBean.readAllBoards}>
is causing all of my buttons (of default type, not type="button"> to call the same bean method, specifically decryptionBean.readAllBoards
. Here's what I believe to be the relevant part of the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
...
<h:body>
<f:view>
<f:event type="preRenderView" listener="#{decryptionBean.readAllBoards}"/>
</f:view>
...
<p:layout>
<p:layoutUnit id="andon_layout--board1" position="center"
size="50%" styleClass="centered">
<h2>Board 1</h2>
<h:form id="andon_layout--board1--displayForm">
<h:outputLabel for="location_list" value="Board List: " />
<h:selectOneMenu id="location_list" value="Loading..."
required="false">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{decryptionBean.locDropDownArray}" />
</h:selectOneMenu>
<br />
<p:commandButton id="loadBoard1" value="Load board" action="#{decryptionBean.loadBoard}"/>
<h:messages id="b1_messages" />
</h:form>
</p:layoutUnit>
<p:layoutUnit id="andon_layout--board2" position="east"
size="50%" styleClass="centered">
<h2>Board 2</h2>
<h:form id="andon_layout--board2--displayForm">
<h:outputLabel for="location_list" value="Board List: " />
<h:selectOneMenu id="location_list" value="Loading..."
required="false">
<f:selectItem itemLabel="Select One" itemValue="#{decryptionBean.display2}" />
<f:selectItems value="#{decryptionBean.locDropDownArray}" />
</h:selectOneMenu>
<br />
<p:commandButton value="Load board" id="loadBoard2" />
</h:form>
</p:layoutUnit>
</p:layout>
...
loadBoard1 runs decryptionBean.loadBoard()
, as well as decryptionBean.readAllBoards()
, while loadBoard2 only runs decryptionBean.readAllBoards()
. If I remove the <f:event type="preRenderView" listener="#{decryptionBean.readAllBoards}>
line, loadBoard1 and 2 function correctly (calling the correct / no methods). Any ideas about what could be going on?
Thanks in advance!