I'm attempting to use a t:radio in my rich:datatable but it's always complaining about the fact that it can't find the component. I did some googling and I have to declare the full name, but I actually think I'm doing that.
Anyone can point me what I'm doing wrong? The code (I'm not going to give a minified version because I'm guessing it's going wrong with the compositions):
letterDetailTemplate.xhtml:
<h:form id="generateLetterForm">
<ui:include src="addStandardLetterMain.xhtml" />
<ui:include src="addStandardLetterText.xhtml" />
<ui:include src="buttons.xhtml" />
</h:form>
addStandardLetterText.xhtml (the radio button is over here, in the slrDataTable):
<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:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:e="http://minfin.regondes2/entity"
xmlns:ccffdecorate="http://java.sun.com/jsf/composite/ccffdecorate"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:l="http://minfin.regondes2/layout"
xmlns:o="http://omnifaces.org/ui"
xmlns:t="http://myfaces.apache.org/tomahawk">
<ui:param name="entityBB" value="#{letterBB}" />
<ui:param name="type" value="Dossier.Letter" />
<l:screenzone id="addStandardLetterTextPanel"
title="#{AppMessages[type.concat('.addStandardLetterText.title')]}">
<h:outputStylesheet name="letterText.css" library="stylesheets" />
<h:outputScript name="letter.js" library="scripts" />
<a4j:region>
<a4j:outputPanel id="letterTextPanel">
<h:inputTextarea id="letterText" name="letterText"
value="#{entityBB.entity.text}" styleClass="letterText" />
<script type="text/javascript">
language: '#{screen.locale.language}'
CKEDITOR.replace( 'generateLetterForm:letterTex', {
});
</script>
</a4j:outputPanel>
<h:panelGroup styleClass="rButtonPanelAlignLeft" layout="block"
rendered="#{dossierContextBB.dossierContext == 'EDIT'}">
<a4j:commandButton
value="#{AppMessages[type.concat('.add.region')]}"
actionListener="#{entityBB.findAvailableRegionStandardLetters()}"
render="slrPopupFormPanel" limitRender="true" status="ajaxStatus"
onclick="LETTER.CKUpdate()"
oncomplete="#{rich:component('addStandardLetterRegion')}.show();" />
</h:panelGroup>
</a4j:region>
<rich:popupPanel id="addStandardLetterRegion" modal="true"
onmaskclick="#{rich:component('addStandardLetterRegion')}.hide()"
autosized="true">
<f:facet name="header">
<h:outputText
value="#{AppMessages['Dossier.Letter.StandardLetter.region.popup.title']}" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component('addStandardLetterCentrum')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<a4j:outputPanel id="slrPopupFormPanel">
<t:selectOneRadio id="slrOption"
value="#{standardLetterBB.selected}" layout="spread"
converter="#{standardLetterBB.converter}">
<f:selectItems value="#{entityBB.availableStandardLetterText}"
var="standardLetter" itemLabel="" itemValue="#{standardLetter}" />
</t:selectOneRadio>
<rich:dataTable id="slrDataTable"
value="#{entityBB.availableStandardLetterText}"
var="standardLetter" noDataLabel="No standard letters found"
rowKeyVar="index">
<rich:column headerClass="ListTitle">
<t:radio for="generateLetterForm:slrDataTable:slrOption" index="#{index}" />
</rich:column>
<e:column entity="#{standardLetter.dossierType}" type="#{type}"
property="type" />
<e:column entity="#{standardLetter}" type="#{type}"
property="numbering" />
<e:columnTranslatable entity="#{standardLetter}" type="#{type}"
property="text" />
</rich:dataTable>
</a4j:outputPanel>
<div class="rButtonPanel">
<h:commandButton value="#{AppMessages['general.action.add']}">
<a4j:ajax event="click" execute="generateLetterForm"
listener="#{entityBB.addMotivationToReport}"
oncomplete="#{rich:component('addStandardLetterRegion')}.hide()"
render="reportMotivationTextPanel" limitRender="true" />
</h:commandButton>
<a4j:commandButton value="#{AppMessages['general.action.cancel']}"
onclick="#{rich:component('addStandardLetterRegion')}.hide()"
limitRender="true" immediate="true" bypassUpdates="true" />
</div>
</rich:popupPanel>
</l:screenzone>
Note that this view works and renders and displays the data from the backingbean when I remove the t:radio.
The errormessage I'm getting is:
SEVERE: java.lang.IllegalStateException: Could not find component 'generateLetterForm:slrDataTable:slrOption' (calling findComponent on component 'generateLetterForm:slrDataTable:0:j_idt258')
javax.faces.FacesException: java.lang.IllegalStateException: Could not find component 'generateLetterForm:slrDataTable:slrOption' (calling findComponent on component 'generateLetterForm:slrDataTable:0:j_idt258')
Change for="generateLetterForm:slrDataTable:slrOption" to for=":generateLetterForm:slrOption" and specify id for your t:radio in datatable also. Don't forget the ":" before generateLetterForm.
Related
I have implemented a composite component in JSF using primefaces.
<ui:component ...>
<cc:interface>
<cc:facet name="header"/> ...
<cc:interface>
<cc:implementation>
<p:dataTable>
<f:facet name="header">
<c:choose>
<c:when test="#{empty cc.attrs.metadata.headerText}">
<cc:insertFacet name="header" required="true"/>
</c:when>
<c:otherwise>
#{cc.attrs.headerText}
</c:otherwise>
</c:choose>
</f:facet> ...
</dataTable>
</cc:implementation>
When I use it in a normal page it works fine as expected rendering the datatable.
<ui:composition>
<nav:dataTable/>
<f:facet name="header">
<h:outputText value="headerText" />
</f:facet>
</ui:composition>
But when I use it inside a dialog which uses the above composite component, it throws
component.xhtml #28,54
Unable to find facet named 'header' in parent
composite component with id 'j_idt129'
I am making a ajax call to invoke this dialog on click of a link. The dialog comes in different shape and throwing this error in console. Has anyone faced it ? Any help is really appreciable.
cc:insertFacet inserts the whole f:facet tag, so you shouldn't wrap it into another f:facet tag within the composite implementation. As you are writing a custom p:dataTable I think it's easier to overwrite the already existing header facelet as an interface declaration and conditionally render it using JSTL utilities:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<composite:interface>
<composite:facet name="header" />
<composite:attribute name="title" />
</composite:interface>
<composite:implementation>
<p:dataTable>
<!-- If the facet is given at parent, insert it.
Otherwise, provide the title given by the attribute -->
<c:choose>
<c:when test="#{not empty cc.facets.header}">
<composite:insertFacet name="header" />
</c:when>
<c:otherwise>
<f:facet name="header">
#{cc.attrs.title}
</f:facet>
</c:otherwise>
</c:choose>
<p:column headerText="column" />
</p:dataTable>
</composite:implementation>
</h:body>
</html>
Using it as:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:comp="http://java.sun.com/jsf/composite/comp">
<f:view>
<h:head />
<h:body>
<h:form>
<comp:myTable title="header">
<f:facet name="header">
<h:outputText value="text" />
</f:facet>
</comp:myTable>
<comp:myTable title="Custom header" />
<p:commandButton type="button" onclick="dialog.show()"
value="show in dialog" />
<p:dialog widgetVar="dialog">
<comp:myTable title="header">
<f:facet name="header">
<h:outputText value="text" />
</f:facet>
</comp:myTable>
</p:dialog>
</h:form>
</h:body>
</f:view>
</html>
In this page this part get called twice. I can't see the reason for this. The problem this leads to is that the selections in the selectonemenu will get reset and then return the incorrect result for the second call.
ServiceSeries is a session bean.
Can anyone tell me why this double call happens?
<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>
If I understand your problem description correctly, its expected behavior; JSF has 6 lifecycles for a request and the same method may be invoked in each and every one of them; in my experience it sometimes happens twice and sometimes happens three times in a single request depending on which phases JSF invokes and which ones it skips.
Its your job to know that this can happen, when it can happen (by studying the lifecycle phases) and design your code accordingly, for example by ensuring that the methods return exactly the same thing for each and every lifecycle phase. There are multiple strategies that may apply, such as utilizing specific scopes (view, session, conversation), through lazy initialization or by using a bean init method annotated with PostConstruct to do one time initialization for a bean.
If you need further assistance, I suggest you post the relevant server side (Java) code too. the problem originates there somewhere.
This might help: http://balusc.blogspot.nl/2006/09/debug-jsf-lifecycle.html
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<h:head>
<title>Community</title>
</h:head>
<h:body>
<rich:panel>
<f:facet name="header">
<h:outputText value="Login form" />
</f:facet>
<h:form id="loginform">
<h:panelGrid columns="2" width="210">
<rich:validator id="loginformvalidate">
<h:outputText value="Username:" />
<h:inputText label="username" id="username" value="#{loginMB.username}" required="true" requiredMessage="user name is requried">
<f:validateLength minimum="5" />
</h:inputText>
<h:outputText value="Password" />
<h:inputSecret label="password" id="password" value="#{loginMB.password}" requiredMessage="password is requried">
<f:validateLength minimum="8" maximum="16" />
</h:inputSecret>
</rich:validator>
<rich:notifyMessages stayTime="2000" nonblocking="true" />
<f:facet name="footer">
<a4j:commandButton value="Login"/>
</f:facet>
</h:panelGrid>
</h:form>
</rich:panel>
<rich:panel>
<h:form id="Questions">
<rich:dataTable value="#{contentBean.questions}" var="list" id="question" >
<rich:column>#{list.QUserid.fname}</rich:column><br/>
<rich:column> <rich:collapsiblePanel expanded="false" header="#{list.questionValue}" switchType="client" onclick="#{contentBean.onclick(list.qid)}" >
<rich:accordion id="answer" switchType="ajax">
<a4j:repeat value="#{contentBean.ansList}" var="skinName" >
<rich:accordionItem name="#{skinName.ansDate}">
#{skinName.ansValue}
</rich:accordionItem>
</a4j:repeat>
</rich:accordion></rich:collapsiblePanel></rich:column>
<br/><rich:column>
<h:commandButton value="Show popup">
<rich:componentControl target="popup" operation="show">
<a4j:param noEscape="true" value="event" />
<rich:hashParam>
<f:param name="width" value="500" />
<f:param name="height" value="300" />
<f:param name="minWidth" value="300" />
<f:param name="minHeight" value="150" />
<a4j:param noEscape="true" name="left" value="(jQuery(window).width()/2)-250" />
<a4j:param noEscape="true" name="top" value="(jQuery(window).height()/2)-150" />
</rich:hashParam>
</rich:componentControl>
</h:commandButton>
<rich:popupPanel id="popup" modal="false" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Add your answer" />
</f:facet>
<p>Enter your answer in less than 4000 char</p>
<p>
<h:inputTextarea id="answertxt" value="#{contentBean.ansvalue}" required="true" requiredMessage="this feild is required"/>
<h:commandButton value="Submit" onclick="#{rich:component('popup')}.hide(); return false;">
<a4j:actionListener for="Submit" listener="#{contentBean.addAnswer(list.QUserid,list.QGroupid, list)}"/>
</h:commandButton>
</p>
</rich:popupPanel>
</rich:column>
</rich:dataTable>
</h:form>
</rich:panel>
</h:body>
</html>
I am new to jsf and richfaces i am tring to create two panels in singles with different forms can i do that? the page worked until i have added new button which uses action listener in a popup window
i am getting following error
INFO: WEB0671: Loading application [My_community] at [/My_community]
INFO: My_community was successfully deployed in 19,911 milliseconds.
SEVERE: /index.xhtml #21,61 id="loginformvalidate" Unhandled by MetaTagHandler for type org.richfaces.component.behavior.ClientValidatorImpl
the page runs but submit button on popup generated action listener is not working
please let me know if i am doing any thing wrong
Are you sure, rich:validator can have children ? I think it should be inside the fields you want to validate:
<h:inputText label="username" id="username" value="#{loginMB.username}" required="true" requiredMessage="user name is requried">
<f:validateLength minimum="5" />
<rich:validator/>
</h:inputText>
I have this code, currently working:
<?xml version="1.0" encoding="UTF-8"?>
<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:p="http://primefaces.org/ui"
template="/templates/default.xhtml">
<ui:define name="content">
<h:form id="form">
<p:dataTable id="clienti" var="c" value="#{clientiController.clienti}" rowKey="#{c.id}">
<p:column headerText="Ragione sociale">
<h:outputText value="#{c.ragioneSociale}" />
</p:column>
<p:column headerText="Codice fiscale">
<h:outputText value="#{c.codiceFiscale}" />
</p:column>
<p:column style="width:4%">
<p:commandButton
update=":formDialog:clienteEditDialog"
oncomplete="clienteEditDialog.show()"
value="Modifica"
title="Modifica">
<f:setPropertyActionListener value="#{c}" target="#{clientiController.clienteSelezionato}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:commandButton
value="Aggiorna"
actionListener="#{clientiController.aggiorna}"
update=":form:clienti"
icon="ui-icon-arrowrefresh-1-n" />
<p:commandButton
value="Nuovo Cliente"
actionListener="#{clientiController.nuovo}"
update=":formDialog:clienteEditDialog"
oncomplete="clienteEditDialog.show()" />
</h:form>
<h:form id="formDialog">
<p:dialog
header="Modifica Cliente"
widgetVar="clienteEditDialog"
id="clienteEditDialog"
showEffect="fade"
hideEffect="explode"
closable="true">
<h:panelGrid id="clienteEditDialogTable" columns="2" cellpadding="10" style="margin:0 auto;">
<p:outputLabel for="fieldNome" value="Ragione Sociale:" />
<p:inputText id="fieldNome" value="#{clientiController.clienteSelezionato.ragioneSociale}" />
<p:outputLabel for="fieldCodice" value="Codice:" />
<p:inputText id="fieldCodice" value="#{clientiController.clienteSelezionato.codiceFiscale}" required="true" requiredMessage="Codice fiscale obbligatorio" />
</h:panelGrid>
<p:commandButton
value="Conferma modifiche"
actionListener="#{clientiController.modifica}"
update=":form:clienti"
oncomplete="clienteEditDialog.hide()"
rendered="#{clientiController.clienteSelezionato.id!=null}" />
<p:commandButton
value="Conferma nuovo cliente"
actionListener="#{clientiController.crea}"
update=":form:clienti"
oncomplete="clienteEditDialog.hide()"
rendered="#{clientiController.clienteSelezionato.id==null}" />
</p:dialog>
</h:form>
</ui:define>
</ui:composition>
Now I'd really like my dialog to be modal, so I add modal=true to my .
The result is my dialog appears "under" the overlay.
After a bit searching, I found that appendToBody=true would solve my problem, so I try it and my dialog appears the right way.
But... WTF??! Buttons inside the dialog stop working!!
BUG? Or is there any solution?
Move <h:form id="formDialog"> inside the dialog
Because when you use appendToBody=true the content of the dialog being appended to the BODY of your page... And in you case its being taken outside the h:form and as you know commandButtons must reside within a h:form in order to work....
Like this
<p:dialog appendToBody="true".....
<h:form id="formDialog">
.....
When working with dialogs allays remember to place your h:forms inside the dialog...
When I defined 2 actionListeners in a composite table, the first actionListener will be called twice when I click it, but the second listener works fine without the problem. Even I switched the 2 listeners, always the first one called twice and the second one fine.
Here is the xhtml:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:asias="http://java.sun.com/jsf/composite/components/asias"
xmlns:test="http://java.sun.com/jsf/composite/test">
<h:head />
<h:body>
<h:form id="communityMembersForm">
<test:outertable list="#{memberController.members}"
title="Nested Table Test">
<f:actionListener for="sortAction"
binding="#{memberController.sortActionListener}" />
<f:actionListener for="actions"
binding="#{memberController.actionsActionListener}" />
</test:outertable>
</h:form>
</h:body>
</html>
MemberController is a viewScoped managed bean. outertable is defined as:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:test="http://java.sun.com/jsf/composite/test"
xmlns:asias="http://java.sun.com/jsf/composite/components/asias">
<composite:interface>
<composite:attribute name="list" required="true" />
<composite:attribute name="title" required="true" />
<composite:actionSource name="sortAction" targets="communityMembersPage" />
<composite:actionSource name="actions" targets="communityMembersPage" />
</composite:interface>
<composite:implementation>
<div>
<h3>#{cc.attrs.title}</h3>
<asias:memberTable id="communityMembersPage" memberList="#{cc.attrs.list}"
showPhone="true" showRoles="true" showAffiliation="true"
showLastLoginDate="true" showActions="true" allowSortLastName="true"
allowSortFirstName="true" allowSortEmail="true" />
</div>
</composite:implementation>
</html>
memberTable is defined as:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface name="memberTable"
displayName="A table for members of a community">
<composite:attribute name="memberList" required="true" />
<composite:attribute name="showPhone" type="java.lang.Boolean" default="false" />
<composite:attribute name="showRoles" type="java.lang.Boolean" default="false" />
<composite:attribute name="showAffiliation" type="java.lang.Boolean"
default="false" />
<composite:attribute name="showLastLoginDate" type="java.lang.Boolean"
default="false" />
<composite:attribute name="showActions" type="java.lang.Boolean"
default="false" />
<composite:attribute name="allowSortLastName" type="java.lang.Boolean"
default="false" />
<composite:attribute name="allowSortFirstName" type="java.lang.Boolean"
default="false" />
<composite:attribute name="allowSortEmail" type="java.lang.Boolean"
default="false" />
<composite:actionSource name="sortAction"
targets="dataTable:sortLastName dataTable:sortFirstName dataTable:sortEmail" />
<composite:actionSource name="actions" targets="dataTable:actions" />
</composite:interface>
<composite:implementation>
<div id="#{cc.clientId}" class="member-table">
<h:dataTable id="dataTable" value="#{cc.attrs.memberList}" var="member"
rowClasses="odd,even"
columnClasses="column1,column2,column3,column4,column5,column6,column7">
<h:column>
<f:facet name="header">
<h:commandLink id="sortLastName"
rendered="#{cc.attrs.allowSortLastName}">
<f:attribute name="sortBy" value="lastName" />
<span>#{i18n['last-name']}</span>
</h:commandLink>
<h:outputText rendered="#{not cc.attrs.allowSortLastName}"
value="#{i18n['last-name']}" />
</f:facet>
<span class='#{member.invalid ? "warning" : "" }'>#{member.lastName}</span>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink id="sortFirstName"
rendered="#{cc.attrs.allowSortFirstName}">
<f:attribute name="sortBy" value="firstName" />
<span>#{i18n['first-name']}</span>
</h:commandLink>
<h:outputText rendered="#{not cc.attrs.allowSortFirstName}"
value="#{i18n['first-name']}" />
</f:facet>
<span class='#{member.invalid ? "warning" : "" }'>#{member.firstName}</span>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink id="sortEmail"
rendered="#{cc.attrs.allowSortEmail}">
<f:attribute name="sortBy" value="email" />
<span>#{i18n['email-address']}</span>
</h:commandLink>
<h:outputText rendered="#{not cc.attrs.allowSortEmail}"
value="#{i18n['email-address']}" />
</f:facet>
<span class='#{member.invalid ? "warning" : "" }'>#{member.email}</span>
</h:column>
<h:column
rendered="#{cc.attrs.showPhone and loginUser.allowedToViewPhone}">
<f:facet name="header">#{i18n['phone-number']}</f:facet>
<span class='#{member.invalid ? "warning" : "" }'>#{member.phoneNumber}</span>
</h:column>
<h:column
rendered="#{cc.attrs.showRoles and loginUser.allowedToViewRoles}">
<f:facet name="header">#{i18n['roles']}</f:facet>
<span class='#{member.invalid ? "warning" : "" }'> <ui:repeat
value="#{member.roles}" var="role" varStatus="roleStatus">
<h:outputText rendered="#{roleStatus.index > 0}" value=", " />
#{role}
</ui:repeat>
</span>
</h:column>
<h:column
rendered="#{cc.attrs.showAffiliation and loginUser.allowedToViewAffiliation}">
<f:facet name="header">#{i18n['user-affiliation']}</f:facet>
<span class='#{member.invalid ? "warning" : "" }'>#{member.userAffiliation}</span>
</h:column>
<h:column
rendered="#{cc.attrs.showLastLoginDate and loginUser.allowedToViewLastLoginDate}">
<f:facet name="header">#{i18n['last-login-date']}</f:facet>
<h:outputText styleClass='#{member.invalid ? "warning" : "" }'
value="#{member.lastLoginDate}" converter="#{dateToWeeksOldConverter}" />
</h:column>
<h:column
rendered="#{cc.attrs.showActions and loginUser.allowedToViewActions}">
<f:facet name="header">#{i18n['actions']}</f:facet>
<h:commandLink id="actions">
<span>#{i18n['actions']}</span>
<f:attribute name="communityMember" value="#{member}" />
</h:commandLink>
</h:column>
</h:dataTable>
<h:outputText styleClass="warning" rendered="#{empty cc.attrs.memberList}"
value="#{i18n['no-records-found']}." />
</div>
</composite:implementation>
</html>
Here is the output:
Dec 6, 2012 11:11:08 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3328 ms
11:23:01,616 INFO MemberController:43 - constructing MemberController
11:23:07,446 DEBUG MemberController:139 - getSortActionListener called
11:23:07,456 DEBUG MemberController:180 - constructing comparator map
11:23:07,466 DEBUG MemberController:213 - constructing SortActionListener
11:23:07,476 DEBUG MemberController:227 - Sorting by lastName Ascending (MemberController$SortActionListener#779d9c0d)
11:23:07,476 DEBUG MemberController:139 - getSortActionListener called
11:23:07,476 DEBUG MemberController:227 - Sorting by lastName Descending (MemberController$SortActionListener#779d9c0d)
11:23:12,116 DEBUG MemberController:127 - getActionsActionListener called
11:23:12,126 DEBUG MemberController:132 - action for homer#simpsons.tv
From the output, the first actionListener called twice, but the second one just once as expected.
This was run under tomecat 6.0.36 using jsf 2.1.13. If I use myfaces instead of jsf, don't have this problem.