私は、タブフォームタグでネストされたダイアログフォームを持つデータテーブルを持っています.... データテーブルの各行には、ダイアログフォームのデータを編集して表示するボタンがあります。編集ボタンまたは表示ボタンでは、フォームに記入されません...そして、私は更新プロパティの何が問題なのか分かりません....更新プロパティが機能していないようです
私はまた、作成および更新プロセス後にデータテーブルを更新しようとしましたフォームcommanButtonに更新プロパティを設定することで、何かが欠けているようだ...
私もこのリンクを訪れた... update-form-on-hcommandbutton-action 、私の場合には動作していないよう...多分理由更新プロパティがコアに設定されていません。 は私がtabView、レイアウトやLayoutUnitタグを削除すると、それが正しく
作品ここに私のいるindex.xhtmlコードさ:
<h:body>
<ui:composition template="/template.xhtml">
<ui:define name="content">
<f:view>
<p:tabView id="tout">
<p:tab title="Identite" id="test">
<p:layout style="min-width:400px;min-height:450px;" id="change">
<p:layoutUnit position="center" id="tester">
/* this Dialog form is for creating a new Antecedent*/
<p:dialog showEffect="drop" hideEffect="drop" id="creation" widgetVar="creation" header="Enregistrer locataire">
<h:form id="creer">
<center>
<p:panelGrid columns="4">
<p:outputLabel value="DateDiagnostic:" for="dateDiagnostic" />
<p:inputText id="dateDiagnostic" value="#{antecedentMBean.antecedent.dateDiagnostic}" title="DateDiagnostic" >
<f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
</p:inputText>
<p:outputLabel value="DateGuerison:" for="dateGuerison" />
<p:inputText id="dateGuerison" value="#{antecedentMBean.antecedent.dateGuerison}" title="DateGuerison" >
<f:convertDateTime pattern="MM/dd/yyyy" />
</p:inputText>
<p:outputLabel value="Allergies:" for="allergies" />
<p:inputText id="allergies" value="#{antecedentMBean.antecedent.allergies}" title="Allergies" />
<p:outputLabel value="Therapie:" for="therapie" />
<p:inputText id="therapie" value="#{antecedentMBean.antecedent.therapie}" title="Therapie" />
</p:panelGrid>
<p:panelGrid columns="1">
<p:outputLabel value="Diagnostique:" for="diagnostique" />
<p:inputTextarea id="diagnostique" value="#{antecedentMBean.antecedent.diagnostique}" title="Diagnostique" autoResize="false" rows="6" cols="83"/>
</p:panelGrid>
<hr/>
</center>
<center>
<p:button icon="fa fa-close" value="Fermer" onclick="PF('creation').hide();
return false" />
<p:commandButton icon="fa fa-trash" id="effacer" value="Effacer" type="reset"/>
<p:commandButton icon="fa fa-save" value="Enregistrer" action="#{antecedentMBean.createAntecedent()}"
update=":formulaire:tbl" oncomplete="PF('creation').hide()" />
</center>
</h:form>
</p:dialog>
<h:form id="formulaire">
/* this Dialog form is for etiting */
<p:dialog showEffect="size" id="modif" hideEffect="size" widgetVar="modif" header="Modification">
<p:outputPanel id="repere" style="text-align:center;">
<center>
<p:panelGrid columns="4">
<p:outputLabel value="DateDiagnostic:" for="dateDiagnostic" />
<p:inputText id="dateDiagnostic" value="#{antecedentMBean.antecedent.dateDiagnostic}" title="DateDiagnostic" >
<f:convertDateTime pattern="MM/dd/yyyy" />
</p:inputText>
<p:outputLabel value="DateGuerison:" for="dateGuerison" />
<p:inputText id="dateGuerison" value="#{antecedentMBean.antecedent.dateGuerison}" title="DateGuerison" >
<f:convertDateTime pattern="MM/dd/yyyy" />
</p:inputText>
<p:outputLabel value="Allergies:" for="allergies" />
<p:inputText id="allergies" value="#{antecedentMBean.antecedent.allergies}" title="Allergies" />
<p:outputLabel value="Therapie:" for="therapie" />
<p:inputText id="therapie" value="#{antecedentMBean.antecedent.therapie}" title="Therapie" />
</p:panelGrid>
<p:panelGrid columns="1">
<p:outputLabel value="Diagnostique:" for="diagnostique" />
<p:inputTextarea id="diagnostique" value="#{antecedentMBean.antecedent.diagnostique}" title="Diagnostique" autoResize="false" rows="6" cols="83"/>
</p:panelGrid>
<hr/>
</center>
<center>
<p:button icon="fa fa-close" value="Fermer" onclick="PF('modif').hide();
return false" />
<p:commandButton icon="fa fa-trash" id="effacer" value="Effacer" type="reset"/>
<p:commandButton icon="fa fa-pencil" value="Modifier" action="#{antecedentMBean.updateAntecedent()}"
update=":formulaire:tbl" onclick="PF('modif').hide()" />
</center>
</p:outputPanel>
</p:dialog>
/* this Dialog form is for displaying a row details */
<p:dialog showEffect="size" hideEffect="size" id="voir" widgetVar="voir" header="Modification">
<p:outputPanel id="view" style="text-align:center;">
<center>
<p:panelGrid columns="4">
<p:outputLabel value="IdAntecedent:"/>
<h:outputText value="#{antecedentMBean.antecedent.idAntecedent}" title="IdAntecedent"/>
<p:outputLabel value="DateDiagnostic:"/>
<h:outputText value="#{antecedentMBean.antecedent.dateDiagnostic}" title="DateDiagnostic">
<f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
</h:outputText>
<p:outputLabel value="DateGuerison:"/>
<h:outputText value="#{antecedentMBean.antecedent.dateGuerison}" title="DateGuerison">
<f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
</h:outputText>
<p:outputLabel value="Allergies:"/>
<h:outputText value="#{antecedentMBean.antecedent.allergies}" title="Allergies"/>
<p:outputLabel value="Therapie:"/>
<h:outputText value="#{antecedentMBean.antecedent.therapie}" title="Therapie"/>
<p:outputLabel value="Diagnostique:"/>
<h:outputText value="#{antecedentMBean.antecedent.diagnostique}" title="Diagnostique"/>
<p:outputLabel value="CreerPar:"/>
<h:outputText value="#{antecedentMBean.antecedent.creerPar}" title="CreerPar"/>
<p:outputLabel
<p:outputLabel value="DateCreer:"/>
<h:outputText value="#{antecedentMBean.antecedent.dateCreer}" title="DateCreer">
<f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
</h:outputText>
<p:outputLabel value="MajPar:"/>
<h:outputText value="#{antecedentMBean.antecedent.majPar}" title="MajPar"/>
<p:outputLabel value="DateMaj:"/>
<h:outputText value="#{antecedentMBean.antecedent.dateMaj}" title="DateMaj">
<f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
</h:outputText>
<p:outputLabel value="IdPatient:"/>
<h:outputText value="#{antecedentMBean.antecedent.idPatient.prenom}" title="IdPatient"/>
</p:panelGrid>
<hr/>
</center>
<p:button icon="fa fa-close" value="Fermer" onclick="PF('voir').hide();
return false" />
</p:outputPanel>
</p:dialog>
/* this commandButton display the create form */
<p:commandButton icon="fa fa-plus" value="Creer"
onclick="PF('creation').show()"/>
/* Here is my dataTable */
<p:dataTable id="tbl" value="#{antecedentMBean.listAllAntecedents()}" var="item"
emptyMessage="Aucun Antecedent trouvee" widgetVar="AntecedentTable"
paginator="true" paginatorTemplate="{CurrentPageReport}
{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink}
{LastPageLink} {RowsPerPageDropdown} " paginatorPosition="top" rowsPerPageTemplate="5,10"
>
<f:facet name="header">
Liste des Patients
</f:facet>
<p:column>
<f:facet name="header">
<h:outputText value="IdAntecedent"/>
</f:facet>
<h:outputText value="#{item.idAntecedent}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="DateDiagnostic"/>
</f:facet>
<h:outputText value="#{item.dateDiagnostic}">
<f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="DateGuerison"/>
</f:facet>
<h:outputText value="#{item.dateGuerison}">
<f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Allergies"/>
</f:facet>
<h:outputText value="#{item.allergies}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Therapie"/>
</f:facet>
<h:outputText value="#{item.therapie}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Diagnostique"/>
</f:facet>
<h:outputText value="#{item.diagnostique}"/>
</p:column>
<p:column headerText="Action" style="width:18%" exportable="false">
<div class="ui-g">
<div class="ui-g-4">
/* Here are the buttons for editing*/
<p:commandButton icon="fa fa-pencil" update=":formulaire:repere" oncomplete="PF('modif').show()">
<f:setPropertyActionListener value="#{item}" target="#{antecedentMBean.antecedent}" />
</p:commandButton>
</div>
<div class="ui-g-4">
/* Here are the buttons for deleting*/
<p:commandButton icon="fa fa-trash" style="background-color: red" type="button" onclick="PF('cd').show()" />
<p:confirmDialog message="Voulez vous vraiment supprimer cet enregistrer?"
header="Suppression en cours" severity="alert"
widgetVar="cd" global="true" showEffect="bounce" hideEffect="bounce">
<p:commandButton value="Oui" action="#{antecedentMBean.deleteAntecedent()}"
oncomplete="PF('cd').hide()" icon="ui-icon-check">
<f:setPropertyActionListener target="#{antecedentMBean.antecedent}" value="#{item}"/>
</p:commandButton>
<p:commandButton value="Non" onclick="PF('cd').hide();" type="button" icon="ui-icon-close"/>
</p:confirmDialog>
</div>
<div class="ui-g-4">
/* Here are the buttons for displaying*/
<p:commandButton icon="fa fa-binoculars" update=":formulaire:view" oncomplete="PF('voir').show()">
<f:setPropertyActionListener value="#{item}" target="#{antecedentMBean.antecedent}" />
</p:commandButton>
</div>
</div>
</p:column>
</p:dataTable>
</h:form>
</p:layoutUnit>
</p:layout>
</p:tab>
</p:tabView>
</f:view>
</ui:define>
</ui:composition>
</h:body>
アン、ここでは私のmanagedbeanです: パッケージmanagedbeans。私はPrimeFaces 6.1 Netbeansの8.2を使用してい
import entities.Operation;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
import sessions.OperationFacadeLocal;
Named(value = "operationMBean")
@ViewScoped
public class OperationMBean implements Serializable{
@EJB
private OperationFacadeLocal operationFacade;
private List<Operation> operationList;
private Operation operation;
private Date date = new Date();
public OperationFacadeLocal getOperationFacade() {
return operationFacade;
}
public void setOperationFacade(OperationFacadeLocal operationFacade) {
this.operationFacade = operationFacade;
}
public List<Operation> getOperationList() {
return operationList;
}
public void setOperationList(List<Operation> operationList) {
this.operationList = operationList;
}
public Operation getOperation() {
return operation;
}
public void setOperation(Operation operation) {
this.operation = operation;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public List<Operation> createOperation(){
operation.setDateCree(getDate());
operation.setDateMaj(getDate());
operationFacade.create(operation);
operationList = operationFacade.findAll();
return operationList;
}
public List<Operation> updateOperation(){
operation.setDateMaj(getDate());
operationFacade.edit(operation);
operationList = operationFacade.findAll();
return operationList;
}
public List<Operation> deleteOperation(){
operationFacade.remove(operation);
operationList = operationFacade.findAll();
return operationList;
}
/**
* Creates a new instance of OperationMBean
*/
public OperationMBean() {
}
}
Glassfishの4.1 希望私は私の質問に事前に おかげで明らかにされてきました!
のおかげで受け入れられたとして –
答えをマークすることを忘れないでください。そして、忘れてはいけない
元の質問を[mcve]にする。それで多くのコードを作成する方法 – Kukeltje