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>
Related
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
I made my code like de PF Showcase, but it does't works... When i click my commandLink nothing happens. Anyone can help me? I already added Apache POI and iText.
<h:form id="form">
<p:commandButton value="Novo" icon="ui-icon-document"
actionListener="#{controleBean.novoReservatorio()}" process="#this"
update="dataTable reservatorio-dialog"
oncomplete="PF('reservatorioDialog').show()" class="botaoDataTable">
<p:resetInput target="reservatorio-dialog" />
</p:commandButton>
<p:commandButton icon="ui-icon-pencil" id="btnEditar" title="Editar"
disabled="#{controleBean.reservatorio == null}"
class="botaoDataTable" process="#this" update="dataTable :form"
oncomplete="PF('reservatorioDialog').show()">
<p:resetInput target="reservatorio-dialog" />
<f:setPropertyActionListener target="#{controleBean.reservatorio}"
value="#{controleBean.reservatorioSelecao}" />
</p:commandButton>
<p:commandButton icon="ui-icon-trash" id="btnExcluir"
title="Excluir" disabled="#{controleBean.reservatorio == null}"
class="botaoDataTable" action="#{controleBean.excluirReservatorio}"
process="#this" update="dataTable btnExcluir btnEditar" />
<p:dataTable var="r" value="#{controleBean.reservatorios}"
paginator="true" rows="30" id="dataTable"
emptyMessage="Nenhum Reservatorio Cadastrado"
paginatorPosition="bottom"
selection="#{controleBean.reservatorioSelecao}"
selectionMode="single" rowKey="#{r.idReservatorio}">
<p:ajax event="rowSelect"
update=":form:btnEditar :form:btnExcluir" />
<p:ajax event="rowUnselect"
update=":form:btnEditar :form:btnExcluir" />
<p:column headerText="Nome">
<h:outputText value="#{r.nomeReservatorio}" />
</p:column>
<p:column headerText="Capacidade (Lt)">
<h:outputText value="#{r.capacidadeReservatorio}" />
</p:column>
<p:column headerText="Tipo">
<h:outputText value="#{r.tipoReservatorio}" />
</p:column>
<p:column headerText="Observação">
<h:outputText value="#{r.obsReservatorio}" />
</p:column>
</p:dataTable>
<p:commandLink>
<p:graphicImage library="img" name="xlsx.png" width="32" title="Exportar para Excel"/>
<p:dataExporter type="xls" target="dataTable" fileName="Relatorio" />
</p:commandLink>
<h:commandLink>
<p:graphicImage library="img" name="pdf.png" width="37" title="Exportar para PDF"/>
<p:dataExporter type="pdf" target="dataTable" fileName="Relatorio"/>
</h:commandLink>
<p:commandButton value="Exportar para PDF" ajax="false">
<p:dataExporter type="pdf" target=":form:dataTable" fileName="dataTable" />
</p:commandButton>
<p:dialog header="Reservatório" widgetVar="reservatorioDialog"
id="reservatorio-dialog" resizable="false" modal="true"
closeOnEscape="true">
<p:messages style="font-size:70%;" />
<p:panelGrid styleClass="semBorda">
<p:row>
<p:column>
<h:outputLabel for="nomeReservatorio" value="* Nome: "
class="componentePF label" />
</p:column>
<p:column>
<p:inputText id="nomeReservatorio" required="true"
value="#{controleBean.reservatorio.nomeReservatorio}"
requiredMessage="É necessário atribuir um nome à reservatorio"
class="componentePF text" />
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel for="capacidadeReservatorio"
value="* Capacidade (Lt): " class="componentePF label" />
</p:column>
<p:column>
<p:spinner id="capacidadeReservatorio" size="30"
value="#{controleBean.reservatorio.capacidadeReservatorio}"
min="0" stepFactor="1" required="true"
requiredMessage="É necessário atribuir uma capacidade à reservatorio"
class="componentePF text" />
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel for="tipoReservatorio"
value="* Tipo de Reservatório: " class="componentePF label" />
</p:column>
<p:column>
<p:selectOneMenu id="tipoReservatorio" style="font-size:75% !important;"
value="#{controleBean.reservatorio.tipoReservatorio}"
class="componentePF text bold" required="true"
requiredMessage="É necessário atribuir um tipo ao reservatório">
<f:selectItem itemLabel="Escolha um Tipo para o Reservatório"
noSelectionOption="true" />
<f:selectItem itemLabel="Escoamento" itemValue="Escoamento" />
<f:selectItem itemLabel="Reserva" itemValue="Reserva" />
</p:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel for="obsReservatorio" value="Observação: "
class="componentePF label" />
</p:column>
<p:column>
<p:inputText id="obsReservatorio"
value="#{controleBean.reservatorio.obsReservatorio}"
class="componentePF text" />
</p:column>
</p:row>
<p:row>
<p:column colspan="2">
<p:commandButton value="Cadastrar" icon="ui-icon-disk"
action="#{controleBean.cadastrarReservatorio}"
id="cadastrarReservatorio" ajax="false"
class="componentePF button" />
</p:column>
</p:row>
</p:panelGrid>
</p:dialog>
</h:form>
The first <p:commandLink> doesn't work be cause it sends an ajax request. Just add ajax="false" to solve the problem.
See https://stackoverflow.com/a/7740280/1980659 for the root cause explanation.
With what you provided the two other buttons should work.
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.
I am having trouble updating components in primefaces. Here is one example:
<h:form>
<p:panel style="width: 350px;" header="Partial Process">
<p:dataTable id="tablaPersonas" var="per" value="#{manejador.lista}">
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Nombre" />
</f:facet>
<h:outputText value="#{per.nombre}" />
</p:column>
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Apellido" />
</f:facet>
<h:outputText value="#{per.apellido}" />
</p:column>
<p:column headerText="Editar" style="text-align: center;">
<p:commandButton value="Editar"/>
</p:column>
</p:dataTable>
</p:panel>
<p:commandButton value="Abrir" onclick="widgetDlgAgregar.show();"/>
<p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250" height="150" closable="true">
<h:panelGrid id="gridAdd" columns="2">
<h:outputLabel value="Nombre:"/>
<p:inputText value="#{manejador.auxiliarAgregar.nombre}"/>
<h:outputLabel value="Apellido:"/>
<p:inputText value="#{manejador.auxiliarAgregar.apellido}"/>
<p:commandButton oncomplete="widgetDlgAgregar.hide();" update="tablaPersonas,gridAdd" value="Agregar" actionListener="#{manejador.agregarPersona}"/>
</h:panelGrid>
</p:dialog>
</h:form>
As you see, I click on a CommandButton called "Abrir" and a Dialog opens with "Agregar" as title. I fill in the input boxes and when I click the CommandButton "Agregar", the DataTable isn't updated. Why is this happening?
Oh sorry i think you forgot this update
try this it should work
<h:form prependId="false">
<p:panel style="width: 350px;" header="Partial Process">
<p:dataTable id="tablaPersonas" var="per"
value="#{manejador.lista}">
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Nombre" />
</f:facet>
<h:outputText value="#{per.nombre}" />
</p:column>
<p:column style="text-align: center;">
<f:facet name="header">
<h:outputText value="Apellido" />
</f:facet>
<h:outputText value="#{per.apellido}" />
</p:column>
<p:column headerText="Editar" style="text-align: center;">
<p:commandButton value="Editar" />
</p:column>
</p:dataTable>
</p:panel>
<p:commandButton value="Abrir" onclick="widgetDlgAgregar.show();" update="gridAdd" />
<p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250"
height="150" closable="true">
<h:panelGrid id="gridAdd" columns="2">
<h:outputLabel value="Nombre:" />
<p:inputText value="#{manejador.auxiliarAgregar.nombre}" />
<h:outputLabel value="Apellido:" />
<p:inputText value="#{manejador.auxiliarAgregar.apellido}" />
<p:commandButton oncomplete="widgetDlgAgregar.hide();"
update="tablaPersonas,gridAdd" value="Agregar"
actionListener="#{manejador.agregarPersona}" />
</h:panelGrid>
</p:dialog>
</h:form>
try to put your
<p:dialog header="Agregar" widgetVar="widgetDlgAgregar" width="250" height="150" closable="true">
outside the form and add prependId="false" to your form <h:form prependId="false" >