I am creating xhtml page with datascroller in another datascroller . the error that in the second datascrolle always doesn't show any thing.
this in index.xhtml
<p:dataScroller value="#{ideeBean.idees}" var="in" chunkSize="10" mode="inline" scrollHeight="500"
>
<f:facet name="header">
Les Idées
</f:facet>
<h:panelGrid columns="2" style="width:100%" columnClasses="logo,detail">
<!-- <p:graphicImage name="demo/images/car/#{car.brand}-big.gif" /> -->
<p:outputPanel>
<h:panelGrid columns="1" cellpadding="5">
<h:outputText value="#{msg['idee.titre']}" />
<h:outputText value="#{in.titre}" style="font-weight: bold"/>
<h:outputText value="#{msg['idee.description']}" />
<h:outputText value="#{in.description}" style="font-weight: bold"/>
<h:outputText value="#{msg['idee.theme']}" />
<h:outputText value="#{in.theme}" style="font-weight: bold"/>
<h:outputText value="#{msg['idee.type']}" />
<h:outputText value="#{in.type}" style="font-weight: bold"/>
<!-- ***************************comments******************** -->
<p:dataScroller value="#{avisBean.avisl}" var="a" chunkSize="10" mode="inline" scrollHeight="500">
<f:facet name="header">
commentaires
</f:facet>
<h:panelGrid columns="2" style="width:100%" columnClasses="logo,detail" >
<!-- <p:graphicImage name="demo/images/car/#{car.brand}-big.gif" /> -->
<!-- <f:facet name="loader"> -->
<!-- <p:commandButton type="button" value="More" icon="ui-icon-circle-triangle-s"/> -->
<!-- </f:facet> -->
<p:outputPanel>
<h:panelGrid columns="1" cellpadding="5">
<h:outputText value="Commentaire:" />
<h:outputText value="ggg" style="font-weight: bold"/>
</h:panelGrid>
</p:outputPanel>
</h:panelGrid>
</p:dataScroller>
<!-- ***************************************** -->
<h:inputText id="comment" value="#{avisBean.avis.commentaire}" />
<p:commandButton value="commenter" icon="ui-icon-check" action="#{avisBean.addAvis(in)}" />
</h:panelGrid>
</p:outputPanel>
</h:panelGrid>
</p:dataScroller>
and this is the result of the code
enter image description here
Related
I am working on a project that the previous programmer(s) duplicate code everywhere. I need to make a change to some JSF code but don't want to duplicate my changes every where. I figure there has to be a better way.
Here is the scenario; There are multiple dataTable that show up on several different tabs, all on the same page. Each dataTable is the same in every way except that the id and value/data source is different. I need to use the same technology that this was built with so I can't change the version or anything.
Setup:
Websphere 7
Java 1.5
JSF 1.1
Tomahawk 1.1
How can I externalize the dataTable and define the id and value when the dataTable is included? That way I don't have to make the same change multiple times for each table.
Tabbed Panel where each Edit.jsp page contains the dataTable below.
<odc:tabbedPanel id="sampleTab" styleClass="tabbedPanel_3"
slantActiveRight="4" slantActiveLeft="4" slantInactiveRight="4"
slantInactiveLeft="4" width="100%" height="100%"
variableTabLength="true" showBackNextButton="true" showTabs="true">
<!-- Start Test panel -->
<odc:bfPanel id="testsDisplayPanel" name="IPA"
showFinishCancelButton="false">
<jsp:include flush="true" page="editHeader.jsp" />
<jsp:include flush="true" page="testEdit.jsp" />
</odc:bfPanel>
<!-- Start Elisa panel -->
<odc:bfPanel id="elisaDisplayPanel" name="ELISA"
showFinishCancelButton="false">
<jsp:include flush="true" page="editHeader.jsp" />
<jsp:include flush="true" page="elisaEdit.jsp" />
</odc:bfPanel>
<!-- Start NMO Tests panel -->
<odc:bfPanel id="nmoDisplayTestPanel" name="NMO IF"
showFinishCancelButton="false">
<jsp:include flush="true" page="editHeader.jsp" />
<jsp:include flush="true" page="nmoTestEdit.jsp" />
</odc:bfPanel>
<!-- Start IF Tests panel -->
<odc:bfPanel id="ifDisplayTestsPanel" name="PNEO IF"
showFinishCancelButton="false" >
<jsp:include flush="true" page="editHeader.jsp" />
<jsp:include flush="true" page="ifTestEdit.jsp" />
</odc:bfPanel>
<f:facet name="back">
<hx:commandExButton id="tabbedPanel1back" style="display:none"
type="submit" value="< Back" />
</f:facet>
<f:facet name="next">
<hx:commandExButton id="tabbedPanel1next" style="display:none"
type="submit" value="Next >" />
</f:facet>
<f:facet name="finish">
<hx:commandExButton id="tabbedPanel1finish" style="display:none"
type="submit" value="Finish" />
</f:facet>
<f:facet name="cancel">
<hx:commandExButton id="tabbedPanel1cancel" style="display:none"
type="submit" value="Cancel" />
</f:facet>
</odc:tabbedPanel>
Table Example (I shortened it, it really has 20 columns.)
<h:dataTable id="elisaTestResults" styleClass="data-entry"
value="#{pc_SampleEdit.sample.test.elisaTestResults}" var="elisaTestResults" border="0"
cellpadding="0" cellspacing="0" rowClasses="none, grey-highlight">
<!-- hidden input column -->
<h:column>
<h:inputHidden value="#{elisaTestResults.testResultsIk}" />
<h:inputHidden value="#{elisaTestResults.test.testIk}" />
<h:inputHidden value="#{elisaTestResults.dirty}" id="mustSaveT1" />
</h:column>
<!-- Ordered column -->
<h:column id="testResultsOrderedCol">
<f:facet name="header">
<h:outputText id="ot01" styleClass="outputText" value="" />
</f:facet>
<h:selectOneMenu id="ordered" styleClass="selectOneMenu"
rendered="#{elisaTestResults.ordered != null}"
value="#{elisaTestResults.ordered}"
onchange="setDirty(this, 'T1')"
converter="javax.faces.convert.IntegerConverter">
<f:selectItems value="#{pc_UtilRefLists.ordered}" />
</h:selectOneMenu>
</h:column>
<!-- Test Name Column -->
<h:column id="testResultsTestNameCol">
<f:facet name="header">
<h:outputText id="ot02" styleClass="outputText" value="Test Name" />
</f:facet>
<h:outputText id="testResultsTestName" style="font-weight: bold"
value="#{elisaTestResults.testName}" />
</h:column>
<!-- Result1 Column -->
<h:column id="testResultsResult1Col">
<f:facet name="header">
<h:outputText id="ot03" styleClass="outputText" value="Result1" />
</f:facet>
<t:inputText id="testResultsResult1" style="font-weight: bold"
value="#{elisaTestResults.result1}" size="7" maxlength="15"
onchange="setTestDate(this, 'T1')"
displayValueOnly="#{elisaTestResults.valid1 != null && elisaTestResults.valid1}"
displayValueOnlyStyleClass="outputText"/>
</h:column>
<!-- Date1 Column -->
<h:column id="testResultsDate1Col">
<f:facet name="header">
<h:outputText id="ot04" styleClass="outputText" value="Date" />
</f:facet>
<h:panelGroup rendered="#{!elisaTestResults.valid1}">
<h:inputText id="testResultsDate1__DT" styleClass="inputText"
value="#{elisaTestResults.date1}"
onchange="setDirty(this, 'T1')"
size="7">
<f:convertDateTime type="date" pattern="MM/dd/yyyy" />
</h:inputText>
<hx:graphicImageEx id="testResultsDate1__DTCal"
styleClass="graphicImageEx" value="/shared/images/schedule.gif" />
<h:message styleClass="error-message" for="testResultsDate1__DT" />
</h:panelGroup>
<h:outputText id="testResultsDate1" styleClass="outputText"
value="#{elisaTestResults.date1}" rendered="#{elisaTestResults.valid1}">
<f:convertDateTime type="date" pattern="MM/dd/yyyy" />
</h:outputText>
</h:column>
<!-- Valid Result1 Column -->
<h:column id="testResultsValid1Col">
<f:facet name="header">
<h:outputText id="ot05" styleClass="outputText" value="OK" />
</f:facet>
<h:selectBooleanCheckbox id="testResultsValid1"
onchange="setDirty(this, 'T1')"
styleClass="selectBooleanCheckbox" value="#{elisaTestResults.valid1}" />
</h:column>
<!-- Result2 Column -->
<h:column id="testResultsResult2Col">
<f:facet name="header">
<h:outputText id="ot06" styleClass="outputText" value="Result2" />
</f:facet>
<t:inputText id="testResultsResult2" style="font-weight: bold"
value="#{elisaTestResults.result2}" size="7" maxlength="15"
onchange="setTestDate(this, 'T1')"
displayValueOnly="#{elisaTestResults.valid2 != null && elisaTestResults.valid2}"
displayValueOnlyStyleClass="outputText"/>
</h:column>
</h:dataTable>
To solve this problem I broke up the jsf code into several jsp files and inserted them where needed.
dataTableElisa.jsp
<h:dataTable id="elisaTestResults" styleClass="data-entry"
value="#{pc_SampleEdit.sample.test.elisaTestResults}" var="elisaTestResults" border="0"
cellpadding="0" cellspacing="0" rowClasses="none, grey-highlight">
<jsp:include flush="true" page="innerTable.jsp"/>
</h:dataTable>
dataTableNmo.jsp
<h:dataTable id="nmoTestResults" styleClass="data-entry"
value="#{pc_SampleEdit.sample.test.nmoTestResults}" var="elisaTestResults" border="0"
cellpadding="0" cellspacing="0" rowClasses="none, grey-highlight">
<jsp:include flush="true" page="innerTable.jsp"/>
</h:dataTable>
innerTable.jsp
<!-- hidden input column -->
<h:column>
<h:inputHidden value="#{elisaTestResults.testResultsIk}" />
<h:inputHidden value="#{elisaTestResults.test.testIk}" />
<h:inputHidden value="#{elisaTestResults.dirty}" id="mustSaveT1" />
</h:column>
<!-- Ordered column -->
<h:column id="testResultsOrderedCol">
<f:facet name="header">
<h:outputText id="ot01" styleClass="outputText" value="" />
</f:facet>
<h:selectOneMenu id="ordered" styleClass="selectOneMenu"
rendered="#{elisaTestResults.ordered != null}"
value="#{elisaTestResults.ordered}"
onchange="setDirty(this, 'T1')"
converter="javax.faces.convert.IntegerConverter">
<f:selectItems value="#{pc_UtilRefLists.ordered}" />
</h:selectOneMenu>
</h:column>
<!-- Test Name Column -->
<h:column id="testResultsTestNameCol">
<f:facet name="header">
<h:outputText id="ot02" styleClass="outputText" value="Test Name" />
</f:facet>
<h:outputText id="testResultsTestName" style="font-weight: bold"
value="#{elisaTestResults.testName}" />
</h:column>
<!-- Result1 Column -->
<h:column id="testResultsResult1Col">
<f:facet name="header">
<h:outputText id="ot03" styleClass="outputText" value="Result1" />
</f:facet>
<t:inputText id="testResultsResult1" style="font-weight: bold"
value="#{elisaTestResults.result1}" size="7" maxlength="15"
onchange="setTestDate(this, 'T1')"
displayValueOnly="#{elisaTestResults.valid1 != null && elisaTestResults.valid1}"
displayValueOnlyStyleClass="outputText"/>
</h:column>
<!-- Date1 Column -->
<h:column id="testResultsDate1Col">
<f:facet name="header">
<h:outputText id="ot04" styleClass="outputText" value="Date" />
</f:facet>
<h:panelGroup rendered="#{!elisaTestResults.valid1}">
<h:inputText id="testResultsDate1__DT" styleClass="inputText"
value="#{elisaTestResults.date1}"
onchange="setDirty(this, 'T1')"
size="7">
<f:convertDateTime type="date" pattern="MM/dd/yyyy" />
</h:inputText>
<hx:graphicImageEx id="testResultsDate1__DTCal"
styleClass="graphicImageEx" value="/shared/images/schedule.gif" />
<h:message styleClass="error-message" for="testResultsDate1__DT" />
</h:panelGroup>
<h:outputText id="testResultsDate1" styleClass="outputText"
value="#{elisaTestResults.date1}" rendered="#{elisaTestResults.valid1}">
<f:convertDateTime type="date" pattern="MM/dd/yyyy" />
</h:outputText>
</h:column>
<!-- Valid Result1 Column -->
<h:column id="testResultsValid1Col">
<f:facet name="header">
<h:outputText id="ot05" styleClass="outputText" value="OK" />
</f:facet>
<h:selectBooleanCheckbox id="testResultsValid1"
onchange="setDirty(this, 'T1')"
styleClass="selectBooleanCheckbox" value="#{elisaTestResults.valid1}" />
</h:column>
<!-- Result2 Column -->
<h:column id="testResultsResult2Col">
<f:facet name="header">
<h:outputText id="ot06" styleClass="outputText" value="Result2" />
</f:facet>
<t:inputText id="testResultsResult2" style="font-weight: bold"
value="#{elisaTestResults.result2}" size="7" maxlength="15"
onchange="setTestDate(this, 'T1')"
displayValueOnly="#{elisaTestResults.valid2 != null && elisaTestResults.valid2}"
displayValueOnlyStyleClass="outputText"/>
</h:column>
I have recently started to maintain an online system. It is using JSF with PrimeFaces for the front end, with a Java backend. JSF is a new technology for me.
When I execute the app, and click on the buttons, absolutely nothing happens. There are no errors in the execution. It simply doesn't do a thing.
Any ideas?
xHTML file:
<p:form>
<p:dialog header="Détail demande" widgetVar="demandeDialog"
resizable="false" id="demDlg" showEffect="fade" hideEffect="explode"
width="800px" closable="true" appendToBody="true" maximizable="true"
minimizable="true">
<h:commandButton value="Imprimer" type="button" icon="ui-icon-print"
styleClass="alignmentRight">
<p:printer target="displayDem" />
</h:commandButton>
<p:accordionPanel id="displayDem" multiple="true">
<p:tab title="Informations générales">
<h:panelGrid id="displayInfoGen" columns="4" cellpadding="10">
<h:outputText value="N° demande" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.idDemande}" />
<h:outputText value="N° de devis" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.lastDevis.numDevis}" />
<h:outputText value="Date de saisie de la demande"
style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.dateSaisie}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
<h:outputText value="Date de réception de la demande"
style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.dateDemande}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
<h:outputText value="Observations" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.observations}" />
</h:panelGrid>
</p:tab>
<p:tab title="Programmes">
<h:panelGrid columns="4" cellpadding="10">
<h:outputText value="Programme" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.idProgramme.codeProgImmobilier} - #{demandeController.selectedDemande.idProgramme.nomCommercial}" />
<h:outputText value="N° de lot" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.idBien.idBien}" />
<h:outputText value="Nom de l'acquéreur" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.idAcquereur.genreEtatCivil} #{demandeController.selectedDemande.idAcquereur.prenomAcquereur} #{demandeController.selectedDemande.idAcquereur.nomAcquereur}" />
</h:panelGrid>
</p:tab>
<p:tab title="Pièces jointes">
<h:panelGrid columns="4" cellpadding="10">
<h:outputText value="Fiche de demande de TMA"
style="font-weight:bold" />
<h:commandLink action="#{demandeController.displayPj}"
value="#{demandeController.ficheDemandeTma.nom}">
<f:setPropertyActionListener
value="#{demandeController.ficheDemandeTma}"
target="#{demandeController.ficheToDisplay}" />
</h:commandLink>
<h:outputText value="Fiche d'aide à la vente"
style="font-weight:bold" />
<h:commandLink action="#{demandeController.displayPj}"
value="#{demandeController.ficheAideVente.nom}">
<f:setPropertyActionListener
value="#{demandeController.ficheAideVente}"
target="#{demandeController.ficheToDisplay}" />
</h:commandLink>
<h:outputText value="Plans" style="font-weight:bold" />
<h:commandLink action="#{demandeController.displayPj}"
value="#{demandeController.plan.nom}">
<f:setPropertyActionListener value="#{demandeController.plan}"
target="#{demandeController.ficheToDisplay}" />
</h:commandLink>
<h:outputText value="Chèque d'ouverture de dossier reçu"
style="font-weight:bold" />
<h:outputText value="#{demandeController.chequeOuverture}" />
</h:panelGrid>
</p:tab>
<p:tab title="Devis">
<h:panelGrid columns="4" cellpadding="10">
<h:outputText value="Date de validité du devis"
style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.lastDevis.datValidite}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
<h:outputText value="Date du plan de référence"
style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.lastDevis.datPlanReference}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
<h:outputText value="Frais de dossier" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.lastDevis.fraDossiers}" />
<h:outputText value="Frais de pilotage" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.lastDevis.fraPilotage}" />
<h:outputText value="Frais de plan" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.lastDevis.fraPlan}" />
<h:outputText value="Fiche option" style="font-weight:bold" />
<h:outputText
value="#{demandeController.selectedDemande.lastDevis.ficOption}" />
</h:panelGrid>
</p:tab>
<p:tab title="Lignes de chiffrages">
<h:panelGrid columns="1" cellpadding="10">
<p:dataTable var="ligne"
value="#{demandeController.selectedDemande.lastDevis.lignes}"
scrollable="true" scrollHeight="100"
emptyMessage="Pas de lignes" id="listLignes">
<p:column headerText="Lot" style="width: 10%"
sortBy="#{ligne.idLot.libelle}" rowspan="2">
<h:outputText value="#{ligne.idLot.libelle}" />
</p:column>
<p:column headerText="Descriptif" style="width: 27%"
sortBy="#{ligne.libelleDescriptif}" rowspan="2">
<h:outputText value="#{ligne.libelleDescriptif}" />
</p:column>
<p:column headerText="Charge" style="width: 12%"
sortBy="#{ligne.charge}" rowspan="2">
<h:outputText value="#{ligne.charge}" />
</p:column>
<p:column headerText="Qte" style="width: 8%"
sortBy="#{ligne.quantite}" rowspan="2">
<h:outputText value="#{ligne.quantite}" />
</p:column>
<p:column headerText="M. unit" style="width: 9%"
sortBy="#{ligne.montantUnitaire}" rowspan="2">
<h:outputText value="#{ligne.montantUnitaire}" />
</p:column>
<p:column headerText="M. total" style="width: 10%"
sortBy="#{ligne.montantTotal}" rowspan="2">
<h:outputText value="#{ligne.montantTotal}" />
</p:column>
<p:column headerText="Possibilité" style="width: 23%"
sortBy="#{ligne.possibilite}" rowspan="2">
<h:outputText value="#{ligne.possibilite}" />
</p:column>
</p:dataTable>
<h:panelGrid id="charges" columns="4" cellpadding="10"
style="text-align: center;margin-left: 25%;width: 50%; margin-right: 25%; margin-top: 30px; background-color:RGB(225,240,233)">
<h:outputText id="chargeSncHt" value="Charge SNC HT"
style="font-weight:bold" />
<h:outputText for="chargeSncHt"
value="#{demandeController.chargeSncHt}">
<f:convertNumber maxFractionDigits="2" />
</h:outputText>
<h:outputText id="chargeAcqHt" value="Charge Acq HT"
style="font-weight:bold" />
<h:outputText for="chargeAcqHt"
value="#{demandeController.chargeAcqHt}">
<f:convertNumber maxFractionDigits="2" />
</h:outputText>
<h:outputText id="chargeSncTtc" value="Charge SNC TTC"
style="font-weight:bold" />
<h:outputText for="chargeSncTtc"
value="#{demandeController.chargeSncTtc}">
<f:convertNumber maxFractionDigits="2" />
</h:outputText>
<h:outputText id="chargeAcqTtc" value="Charge ACQ TTC"
style="font-weight:bold" />
<h:outputText for="chargeAcqTtc"
value="#{demandeController.chargeAcqTtc}">
<f:convertNumber maxFractionDigits="2" />
</h:outputText>
</h:panelGrid>
</h:panelGrid>
</p:tab>
<p:tab title="Documents">
<h:panelGrid columns="5" cellpadding="2" width="100%"
style="text-align: center">
<h:commandButton title="Générer le devis" id="genDevis"
actionListener="#{demandeController.genererDevis}" immediate="true"
image="/resources/images/pdf.png"
style="vertical-align: middle">
Devis convention.pdf
</h:commandButton>
<p:commandButton title="Plans scannés" id="addPlansScannes"
style="vertical-align: middle; width: 130px;"
onclick="lazyload()" ajax="true" icon="ui-icon-search"
value="Plans scannés">
<f:ajax event="click"
listener="#{demandeController.onPlansClicked}" />
</p:commandButton>
<h:commandButton title="Générer le courrier" id="genCourrier"
action="#{demandeController.genererCourrier}" immediate="true"
image="/resources/images/pdf.png"
style="vertical-align: middle">
Courrier pour les acquereurs.pdf
</h:commandButton>
<h:commandButton title="Générer la fiche suiveuse"
id="genFicheSuiveuse" action="#{ficheSuiveuseController.init}"
immediate="true"
image="/resources/images/excel.png"
style="vertical-align: middle">
Fiche suiveuse.xls
<f:setPropertyActionListener
value="#{demandeController.selectedDemande}"
target="#{ficheSuiveuseController.selectedDemande}" />
</h:commandButton>
</h:panelGrid>
<h:panelGrid columns="1" cellpadding="10" width="100%"
style="text-align: center" id="lazypanel">
<p:dataTable id="plansDT" var="plan"
value="#{demandeController.listPlansScannes}"
rendered="#{demandeController.plansClicked}"
emptyMessage="Pas de Plan">
<p:column headerText="Plans" style="width: 100%"
sortBy="#{plan.nom}">
<h:commandLink action="#{demandeController.displayFiles}"
value="#{plan.nom}">
<f:setPropertyActionListener value="#{plan}"
target="#{demandeController.ficheToDisplay}" />
</h:commandLink>
</p:column>
</p:dataTable>
</h:panelGrid>
<p:remoteCommand name="lazyload" update="lazypanel"
actionListener="#{demandeController.onPlansClicked()}">
</p:remoteCommand>
</p:tab>
</p:accordionPanel>
</p:dialog>
</p:form>
EDIT
When I inspect the element I get this:
<input id="detailsDemandesForm:displayDem:genDevis" type="image" title="Générer le devis" style="vertical-align: middle" name="detailsDemandesForm:displayDem:genDevis" src="/workflowtma-presentation-war/resources/images/pdf.png"></input>
Devis convent…
From a quick glance your issue might be caused by No. 1 of the list of such problems.
In particular your use of appendToBody="true" makes me suspect that Primefaces is moving your dialog out of the <p:form> you declared it in. Try moving the form inside the dialog like so:
<p:dialog ...>
<p:form>
<!-- content goes here -->
</p:form>
</p:dialog>
Ok, this issue is driving me nuts....
I've got this xhtml page, with 2 dialogs...
both dialogs has a form inside to send a submit to the server, they work fine, but when they are called and updated from a commandLink form, actionListener from dialog form just doesn't work, any ideas?
this is the menu where I call the dialogs
<ui:define name="left">
<h:form id="menuForm">
<div class="sidebar-nav">
<div class="well" style="width:150px; padding: 8px 0;">
<ul class="nav nav-list">
<li class="text-center">Options</li>
<li><p:commandLink id="createLink" update=":LocationCreateForm" actionListener="#{locationController.prepareCreate}" oncomplete="LocationCreateDialog.show()"><span class="glyphicon glyphicon-user"></span> Create New</p:commandLink> </li>
<li><p:commandLink id="editLink" update=":LocationEditForm" oncomplete="LocationEditDialog.show()"><span class="glyphicon glyphicon-edit"></span> Update</p:commandLink> </li>
<li><p:commandLink id="deleteLink" actionListener="#{locationController.delete}"><span class="glyphicon glyphicon-ban-circle"></span> Delete</p:commandLink> </li>
</ul>
</div>
</div>
</h:form>
</ui:define>
if I remove the update from commandLink they work, but for edit dialog I can't get the information to edit.
where the dialogs and list are:
<ui:define name="content">
<h1>Locations</h1>
<!-- Location List -->
<h:form id="LocationListForm">
<p:dataTable id="datalist" value="#{locationController.items}" var="item"
selectionMode="single" selection="#{locationController.selected}"
rowKey="#{item.id}"
>
<p:column sortBy="#{item.id}" filterBy="#{item.id}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_id}"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column sortBy="#{item.name}" filterBy="#{item.name}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_name}"/>
</f:facet>
<h:outputText value="#{item.name}"/>
</p:column>
<p:column sortBy="#{item.openingHourMonday}" filterBy="#{item.openingHourMonday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourMonday}"/>
</f:facet>
<h:outputText value="#{item.openingHourMonday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourTuesday}" filterBy="#{item.openingHourTuesday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourTuesday}"/>
</f:facet>
<h:outputText value="#{item.openingHourTuesday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourWednesday}" filterBy="#{item.openingHourWednesday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourWednesday}"/>
</f:facet>
<h:outputText value="#{item.openingHourWednesday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourThrusday}" filterBy="#{item.openingHourThrusday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourThrusday}"/>
</f:facet>
<h:outputText value="#{item.openingHourThrusday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourFriday}" filterBy="#{item.openingHourFriday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourFriday}"/>
</f:facet>
<h:outputText value="#{item.openingHourFriday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourSaturday}" filterBy="#{item.openingHourSaturday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourSaturday}"/>
</f:facet>
<h:outputText value="#{item.openingHourSaturday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourSunday}" filterBy="#{item.openingHourSunday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourSunday}"/>
</f:facet>
<h:outputText value="#{item.openingHourSunday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
</p:dataTable>
</h:form>
<!-- Location Create Dialog -->
<p:dialog id="LocationCreateDlg" widgetVar="LocationCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{myBundle.CreateLocationTitle}">
<h:form id="LocationCreateForm">
<h:panelGroup id="display">
<p:panelGrid columns="2" >
<p:outputLabel value="#{myBundle.CreateLocationLabel_name}" for="name" />
<p:inputText id="name" value="#{locationController.selected.name}" title="#{myBundle.CreateLocationTitle_name}" required="true" requiredMessage="#{myBundle.CreateLocationRequiredMessage_name}"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourMonday}" for="openingHourMonday" />
<p:calendar id="openingHourMonday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourMonday}" title="#{myBundle.EditLocationTitle_openingHourMonday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourMonday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourTuesday}" for="openingHourTuesday" />
<p:calendar id="openingHourTuesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourTuesday}" title="#{myBundle.EditLocationTitle_openingHourTuesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourTuesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourWednesday}" for="openingHourWednesday" />
<p:calendar id="openingHourWednesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourWednesday}" title="#{myBundle.EditLocationTitle_openingHourWednesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourWednesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourThrusday}" for="openingHourThrusday" />
<p:calendar id="openingHourThrusday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourThrusday}" title="#{myBundle.EditLocationTitle_openingHourThrusday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourThrusday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourFriday}" for="openingHourFriday" />
<p:calendar id="openingHourFriday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourFriday}" title="#{myBundle.EditLocationTitle_openingHourFriday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourFriday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourSaturday}" for="openingHourSaturday" />
<p:calendar id="openingHourSaturday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSaturday}" title="#{myBundle.EditLocationTitle_openingHourSaturday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSaturday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourSunday}" for="openingHourSunday" />
<p:calendar id="openingHourSunday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSunday}" title="#{myBundle.EditLocationTitle_openingHourSunday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSunday}" showOn="button"/>
</p:panelGrid>
<p:commandButton actionListener="#{locationController.saveNew}" value="#{myBundle.Save}" update="display,:LocationListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,LocationCreateDialog);"/>
<p:commandButton value="#{myBundle.Cancel}" onclick="LocationCreateDialog.hide();"/>
</h:panelGroup>
</h:form>
</p:dialog>
<!-- Location Update Dialog -->
<p:dialog id="LocationEditDlg" widgetVar="LocationEditDialog" modal="true" resizable="false" appendToBody="true" header="#{myBundle.EditLocationTitle}">
<h:form id="LocationEditForm">
<h:panelGroup id="display">
<p:panelGrid columns="2" rendered="#{locationController.selected != null}">
<h:outputLabel value="#{myBundle.EditLocationLabel_id}" for="id" />
<h:outputText id="id" value="#{locationController.selected.id}" />
<p:outputLabel value="#{myBundle.EditLocationLabel_name}" for="name" />
<p:inputText id="name" value="#{locationController.selected.name}" title="#{myBundle.EditLocationTitle_name}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_name}"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourMonday}" for="openingHourMonday" />
<p:calendar id="openingHourMonday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourMonday}" title="#{myBundle.EditLocationTitle_openingHourMonday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourMonday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourTuesday}" for="openingHourTuesday" />
<p:calendar id="openingHourTuesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourTuesday}" title="#{myBundle.EditLocationTitle_openingHourTuesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourTuesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourWednesday}" for="openingHourWednesday" />
<p:calendar id="openingHourWednesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourWednesday}" title="#{myBundle.EditLocationTitle_openingHourWednesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourWednesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourThrusday}" for="openingHourThrusday" />
<p:calendar id="openingHourThrusday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourThrusday}" title="#{myBundle.EditLocationTitle_openingHourThrusday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourThrusday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourFriday}" for="openingHourFriday" />
<p:calendar id="openingHourFriday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourFriday}" title="#{myBundle.EditLocationTitle_openingHourFriday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourFriday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourSaturday}" for="openingHourSaturday" />
<p:calendar id="openingHourSaturday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSaturday}" title="#{myBundle.EditLocationTitle_openingHourSaturday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSaturday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourSunday}" for="openingHourSunday" />
<p:calendar id="openingHourSunday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSunday}" title="#{myBundle.EditLocationTitle_openingHourSunday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSunday}" showOn="button"/>
</p:panelGrid>
<p:commandButton actionListener="#{locationController.save}" value="#{myBundle.Save}" update="display,:LocationListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,LocationEditDialog);"/>
<p:commandButton value="#{myBundle.Cancel}" onclick="LocationEditDialog.hide();"/>
</h:panelGroup>
</h:form>
</p:dialog>
</ui:define>
Use process = "#this" in p:commandButton and appendTo="#(body)"in p:dialog
solved issue, updated to primefaces 4.0 RC1, changed appendToBody="true", to appendTo="#(body)"
I am creating a view in JSF where after executing some action with a4j:commandButton some elements are rerendered. For example I click on a button which invokes a backing bean method such as executeProcess (this adds a process to a list), and when it finishes updates a data table (shows the available processes). The data table also has some other buttons to execute specific actions over every process, but when I press one of this the page seems to reload entirely without invoking the action, then if I press the same button again it works. What is happening?
Component List an execute:
<div class="line_left" style="float:right">
<a4j:outputPanel id="execProcessPanel" layout="block"
ajaxRendered="true">
<ui:fragment rendered="#{tapeTapeForm.size > 0}">
<h:form id="executeProcess">
<h:outputText value="Ejecuta Proceso" />
<br />
<h:outputLabel id="inputFilesLabel" for="inputFile" value="Archivo" />
<h:selectOneListbox id="inputFile" size="5" required="true"
requiredMessage="Debes seleccionar un archivo"
value="#{tapeTapeForm.inputFile}">
<f:selectItems value="#{tapeTapeForm.inputFiles}" var="file"
itemLabel="#{file}" itemValue="#{file}" />
</h:selectOneListbox>
<br />
<h:message for="inputFile" errorClass="" />
<br />
<a4j:commandButton value="Ejecutar" styleClass="button"
action="#{tapeTapeForm.executeProcess}"
render="resultListPanel execProcessPanel messages"
limitRender="true">
<f:setPropertyActionListener value="0"
target="#{tapeTapeForm.tipoProceso}" />
</a4j:commandButton>
<a4j:commandButton value="Revisión" styleClass="button"
action="#{tapeTapeForm.executeProcess}"
render="resultListPanel execProcessPanel messages"
limitRender="true">
<f:setPropertyActionListener value="1"
target="#{tapeTapeForm.tipoProceso}" />
</a4j:commandButton>
</h:form>
</ui:fragment>
</a4j:outputPanel>
</div>
Component Data Table:
<a4j:outputPanel id="resultListPanel" layout="block"
ajaxRendered="true">
<h2>
<h:outputText value="Listado de Procesos Tape to Tape" />
</h2>
<rich:dataTable id="resultList" var="item" rows="0"
value="#{tapeTapeForm.processes}" noDataLabel="Sin Procesos">
<rich:column sortable="true" sortBy="#{item.id}">
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<center>
<h:outputText value="#{item.id}" />
</center>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Nombre Archivo" />
</f:facet>
<center>
<h:outputText value="#{item.inputFileName}" />
</center>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Archivo Salida" />
</f:facet>
<center>
<h:outputText value="#{item.outputFileName}"
title="Clic para descargar el archivo de salida" />
</center>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Tipo Proceso" />
</f:facet>
<center>
<h:outputText value="Reporte"
title="Este proceso generará un reporte"
rendered="#{item.tipoProceso == 0}" />
<h:outputText value="Revisión"
title="Se realizará una revisión del archivo"
rendered="#{item.tipoProceso == 1}" />
</center>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Estatus" />
</f:facet>
<center>
<h:outputText value="#{item.status.description}"
title="#{item.status.detail}" />
</center>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Progreso" />
</f:facet>
<rich:progressBar value="#{item.avance}" minValue="0"
enabled="false" rendered="#{item.status.id == 3}"
maxValue="#{item.total}" label="#{item.avance} / #{item.total}" />
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Detener" />
</f:facet>
<h:form rendered="#{item.status.id == 2 or item.status.id==3}">
<h:commandLink action="#{tapeTapeForm.stopProcess}" value="STOP"
onclick="#{rich:component('ajaxLoadingModalBox')}.show()">
<f:setPropertyActionListener target="#{tapeTapeForm.id}"
value="#{item.id}" />
</h:commandLink>
</h:form>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Eliminar" />
</f:facet>
<h:form rendered="#{item.status.id !=2 and item.status.id != 3}">
<h:commandLink action="#{tapeTapeForm.removeProcess}"
value="ELIMINAR">
<f:setPropertyActionListener target="#{tapeTapeForm.id}"
value="#{item.id}" />
</h:commandLink>
</h:form>
</rich:column>
</rich:dataTable>
</a4j:outputPanel>
I'm using RichFaces 4.2.2
Get rid of the multiple forms, wrap everything in one and then use if you need to limit the scope of execution.
why when i add a seconde DataTable in my page i lose the entire content of this page ? im using JSF PrimeFaces.
This is my first DataTable:
<p:tab title="Projet">
<!-- ======================== Contenu ======================== -->
<br/>
<h:form id="form">
<p:dataTable var="car" value="xxxxx" selection="xxxx" selectionMode="single">
<f:facet name="header">
Listes des projets Gpsi
</f:facet>
<p:column>
<f:facet name="header">
<h:outputText value="Code" />
</f:facet>
<h:outputText value="xxxx" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Intitulé" />
</f:facet>
<h:outputText value="xxxx" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Dernière Etat" />
</f:facet>
<h:outputText value="xxxx" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Domaine" />
</f:facet>
<h:outputText value="xxxx" />
</p:column>
<f:facet name="footer">
<p:commandButton value="Ouvrire" image="ui-icon ui-icon-search" update="form:display" oncomplete="carDialog.show()"/>
</f:facet>
</p:dataTable>
<p:dialog header="Car Detail" widgetVar="carDialog" resizable="false" width="200" showEffect="clip" hideEffect="fold">
<h:panelGrid id="display" columns="2" cellpadding="4">
<f:facet name="header">
<p:graphicImage value="/images/cars/xxxx.jpg"/>
</f:facet>
<h:outputText value="Model:" />
<h:outputText value="xxxx" />
<h:outputText value="Year:" />
<h:outputText value="xxxx" />
<h:outputText value="Manufacturer:" />
<h:outputText value="xxxx" />
<h:outputText value="Color:" />
<h:outputText value="xxxx" />
</h:panelGrid>
</p:dialog>
</h:form>
And this one in the seconde tab :
<p:tab title="Objets">
<h:form id="form">
<p:dataTable var="car" value="pppp"
selection="mmmm" selectionMode="single">
<f:facet name="header">
Liste des Objets
</f:facet>
<p:column>
<f:facet name="header">
<h:outputText value="Model" />
</f:facet>
<h:outputText value="Model" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Year" />
</f:facet>
<h:outputText value="Year" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Manufacturer" />
</f:facet>
<h:outputText value="Manufacturer" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Color" />
</f:facet>
<h:outputText value="Color" />
</p:column>
<f:facet name="footer">
<p:commandButton value="View" image="ui-icon ui-icon-search"
update="form:display" oncomplete="carDialog.show()"/>
</f:facet>
</p:dataTable>
<p:dialog header="Car Detail" widgetVar="carDialog" resizable="false"
width="200" showEffect="clip" hideEffect="fold">
<h:panelGrid id="display" columns="2" cellpadding="4">
<f:facet name="header">
<p:graphicImage value="sss"/>
</f:facet>
<h:outputText value="Model:" />
<h:outputText value="xxx" />
<h:outputText value="Year:" />
<h:outputText value="xxx" />
<h:outputText value="Manufacturer:" />
<h:outputText value="xxx" />
<h:outputText value="Color:" />
<h:outputText value="xxx" />
</h:panelGrid>
</p:dialog>
</h:form>
<!-- ======================== FIN Contenu ===================== -->
</p:tab>
You should try to enclose your tabView with a single h:form, then place your dataTables inside your tabs:
<h:form id="form">
<p:tabView id="myTabView">
<p:tab id="firstTab">
<p:dataTable ....>
....
</p:dataTable>
</p:tab>
<p:tab id="secondTab">
<p:dataTable ....>
....
</p:dataTable>
</p:tab>
</p:tabView>
</h:form>
Two forms with the same id="form" --> error. Rename one of the forms.