На этой странице эта часть вызывается дважды. Я не вижу причины этого. Проблема заключается в том, что выбор в selectonemenu будет сброшен, а затем вернет неверный результат для второго вызова.Страница, вызывающая одну и ту же функцию дважды JSF
ServiceSeries - это сеансовый компонент.
Может ли кто-нибудь сказать мне, почему этот двойной звонок происходит?
<c:forEach var="list" items="#{serviceSeries.getSeriesForPlayerInfo(club.name, player.stringID, st, calendarBean)}">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/WEB-INF/templates/template.xhtml">
<ui:define name="content">
<h:form>
<div id="left">
<h:commandLink action="player" value="Gå till spelare" />
<br />
<h:commandLink action="club" value="Gå till Klubb" />
<br />
<h:commandLink action="serieType" value="Gå till Serie typ" />
<br />
<h:commandLink action="serie" value="Gå till En serie" />
<br />
<h:commandLink action="serieTotal" value="Gå till Serie Total" />
<br />
<h:commandLink action="showAverages" value="Gå till snittlista" />
<br />
</div>
<div id="right">
<div id="pageHeader">Snitt information</div>
<h:panelGrid columns="2">
Spelare
<p:selectOneMenu value="#{player}"
converter="playerConverter" id="playerList">
<f:selectItem itemLabel="---" noSelectionOption="true" />
<f:selectItems value="#{servicePlayer.allPlayers}"
var="n"
itemValue="#{n}"
itemLabel="#{n.combinedName}"
itemLabelEscaped="true"/>
</p:selectOneMenu>
<h:outputText value="Klubb"></h:outputText>
<p:selectOneMenu id="ClubMenu" value="#{club.name}">
<f:selectItems value="#{serviceHCP.clubs}" />
</p:selectOneMenu>
<h:outputText value="Serietyp"></h:outputText>
<p:selectOneMenu value="#{st}"
converter="serieTypeConverter" id="serieTypeList">
<f:selectItem itemLabel="---" noSelectionOption="true" />
<f:selectItems value="#{serviceSerieType.serieTypes}"
var="st"
itemValue="#{st}"
itemLabel="#{st.serie_type}"
itemLabelEscaped="true"/>
</p:selectOneMenu>
<h:outputText value="Startdatum"></h:outputText>
<p:calendar value="#{calendarBean.date1}" id="popupButtonCal" showOn="button" pattern="yyyy-MM-dd HH:mm:ss" >
</p:calendar>
<h:outputText value="Slutdatum"></h:outputText>
<p:calendar value="#{calendarBean.date2}" id="popupButtonCal2" showOn="button" pattern="yyyy-MM-dd HH:mm:ss" >
</p:calendar>
<h:outputText value=""></h:outputText>
<h:commandButton value="Visa lista" action="showSeriesInfo">
</h:commandButton>
</h:panelGrid>
</div>
<div id="right">
Players
<br />
<!-- h:form -->
<h:panelGrid columns="9" border="1" cellpadding="3">
<h:outputText value="Namn" />
<h:outputText value="ID" />
<h:outputText value="Klubb" />
<h:outputText value="Datum" />
<h:outputText value="typ" />
<h:outputText value="Info" />
<h:outputText value="Antal serier" />
<h:outputText value="Total" />
<h:outputText value="Snitt" />
<c:forEach var="list" items="#{serviceSeries.getSeriesForPlayerInfo(club.name, player.stringID, st, calendarBean)}">
<h:outputText value=" #{list[0].toString() }" />
<h:outputText value=" #{list[1].toString() }" />
<h:outputText value="#{serie.getSerieDateString(list[2]) }" />
<h:outputText value="#{list[3].toString()}"/>
<h:outputText value=" #{list[4].toString() }" />
<h:outputText value=" #{list[5].toString() }" />
<h:outputText value=" #{list[6].toString() }" />
<h:outputText value=" #{list[7].toString() }" />
<h:outputText value=" #{list[8].toString() }" />
</c:forEach>
</h:panelGrid>
</div>
</h:form>
</ui:define>
</ui:composition>
</html>
Вы могли бы наслаждаться этим два вопроса (и их ответы): http://stackoverflow.com/questions/2090033/why-jsf-calls-getters-multiple-times и http://webproverka.com/ //stackoverflow.com/questions/3342984/jstl-in-jsf2-facelets-makes-sense; в частности, попробуйте заменить '' на ''. –
mabi