2017-03-06 3 views
0

Ich arbeite an einem Projekt mit Icefaces API, ich laufe auf ein Problem Ich benutzte eine Befehlsschaltfläche in einer DataTable, die das Objekt in der Zeile löscht, aber wenn ich darauf klicke Server hängt und hält Laden ohne Fehler in der Konsole anzuzeigen.Seite hängt nach commandbutton Aktion innerhalb der Datentabelle

mit Apache-tomcat-7.0.75

meine HTML-Code:

<ui:composition template="./WEB-INF/template/template.xhtml"> 
 
     <ui:param name="titre" value="Liste de Comptes"/> 
 
     <ui:define name="content"> 
 
     <f:view> 
 
      <h:form id="form"> 
 
\t \t \t <ace:dataTable id="cptTable" value="#{compte.allComptes}" 
 
\t \t \t \t var="cpt" paginator="true" paginatorPosition="bottom" rows="10"> 
 
\t \t \t \t 
 
\t \t \t \t ... 
 
\t \t \t \t 
 
\t \t \t \t <ace:column width="10"> 
 
       <f:facet name="header"> 
 
        <h:outputText value="Opérations"/> 
 
       </f:facet> 
 
       <h:commandLink id="dlt" actionListener="#{compte.deletCompte}" title="Supprimer" > 
 
        <f:param name="idcpt" value="#{cpt.id_compte}"/> 
 
        <ace:ajax execute="dlt" render="form"/> 
 
        <br/> 
 
       </h:commandLink> 
 
       <h:link outcome="modifierCompte" value="Modifier le compte" > 
 
        <f:param name="id" value="#{cpt.id_compte}"/> 
 
       </h:link> 
 
       <ice:outputText value=" | "/> 
 
       <h:link outcome="operation" value="Operation sur le compte" > 
 
        <f:param name="id" value="#{cpt.id_compte}"/> 
 
       </h:link> 
 
        
 
       </ace:column> 
 
\t \t \t </ace:dataTable> 
 
\t \t </h:form> 
 
\t \t </f:view> 
 
\t \t </ui:define> 
 
    </ui:composition>

meine Bohne:

package jee.model; 
 

 
import java.io.Serializable; 
 
import java.util.ArrayList; 
 
import java.util.Map; 
 

 
import javax.annotation.PostConstruct; 
 
import javax.faces.bean.ManagedBean; 
 
import javax.faces.bean.SessionScoped; 
 
import javax.faces.context.ExternalContext; 
 
import javax.faces.context.FacesContext; 
 
import javax.servlet.http.HttpSession; 
 

 
import jee.dao.dao; 
 

 
@ManagedBean 
 
@SessionScoped 
 
public class Compte implements Serializable{ 
 

 
\t /** 
 
\t * 
 
\t */ 
 
\t private static final long serialVersionUID = -7177239517089845251L; 
 
\t 
 
\t private int id_compte; 
 
\t private int id_agence; 
 
\t private int id_client; 
 
\t private String num_compte; 
 
\t private double solde; 
 
\t private String date_creation_compte; 
 
\t public ArrayList<Compte> comptes; 
 
\t 
 
\t public Compte() { 
 
\t \t super(); 
 
\t \t this.id_agence=1; 
 
\t \t // TODO Auto-generated constructor stub 
 
\t } 
 

 
\t public Compte(int id_compte, int id_agence, int id_client, 
 
\t \t \t String num_compte, double solde, String date_creation_compte, 
 
\t \t \t ArrayList<Compte> comptes) { 
 
\t \t super(); 
 
\t \t this.id_compte = id_compte; 
 
\t \t this.id_agence = id_agence; 
 
\t \t this.id_client = id_client; 
 
\t \t this.num_compte = num_compte; 
 
\t \t this.solde = solde; 
 
\t \t this.date_creation_compte = date_creation_compte; 
 
\t } 
 
\t 
 
\t 
 

 
\t public int getId_compte() { 
 
\t \t return id_compte; 
 
\t } 
 

 
\t public void setId_compte(int id_compte) { 
 
\t \t this.id_compte = id_compte; 
 
\t } 
 

 
\t public int getId_agence() { 
 
\t \t return id_agence; 
 
\t } 
 

 
\t public void setId_agence(int id_agence) { 
 
\t \t this.id_agence = id_agence; 
 
\t } 
 

 
\t public int getId_client() { 
 
\t \t return id_client; 
 
\t } 
 

 
\t public void setId_client(int id_client) { 
 
\t \t this.id_client = id_client; 
 
\t } 
 

 
\t public String getNum_compte() { 
 
\t \t return num_compte; 
 
\t } 
 

 
\t public void setNum_compte(String num_compte) { 
 
\t \t this.num_compte = num_compte; 
 
\t } 
 

 
\t public double getSolde() { 
 
\t \t return solde; 
 
\t } 
 

 
\t public void setSolde(double solde) { 
 
\t \t this.solde = solde; 
 
\t } 
 

 
\t public String getDate_creation_compte() { 
 
\t \t return date_creation_compte; 
 
\t } 
 

 
\t public void setDate_creation_compte(String date_creation_compte) { 
 
\t \t this.date_creation_compte = date_creation_compte; 
 
\t } 
 

 
\t 
 
\t public void setComptes(ArrayList<Compte> comptes) { 
 
\t \t this.comptes = comptes; 
 
\t } 
 

 
\t public ArrayList<Compte> getComptes() { 
 
\t \t dao d = new dao(); 
 
\t \t ExternalContext ec = 
 
\t \t \t \t FacesContext.getCurrentInstance().getExternalContext(); 
 
\t \t HttpSession session = (HttpSession) ec.getSession(false); 
 
\t \t comptes=d.getComptes((String)session.getAttribute("login")); 
 

 
\t \t return comptes; 
 
\t } 
 
\t 
 
\t public void deletCompte(){ 
 
\t \t dao d = new dao(); 
 
\t \t ExternalContext ec = 
 
\t \t \t \t FacesContext.getCurrentInstance().getExternalContext(); 
 
\t \t Map<String,String> params = ec.getRequestParameterMap(); 
 
\t \t 
 
\t \t d.supprimerCompte(Integer.parseInt(params.get("idcpt"))); 
 
\t } 
 
\t 
 
\t 
 
\t 
 
\t 
 
}

Antwort

0
<h:link outcome="modifierCompte" value="Modifier le compte" > 
       <f:param name="id" value="#{cpt.id_compte}"/> 
      </h:link> 
      <ice:outputText value=" | "/> 
      <h:link outcome="operation" value="Operation sur le compte" > 
       <f:param name="id" value="#{cpt.id_compte}"/> 
      </h:link> 

Doppelte IDs können das verursachen. Sie haben hier doppelte Namen f: param name = "id" wenn gerendert wird erstellt es eine doppelte ID Verwenden Sie debug um zu überprüfen, dass tou keine doppelten IDs haben. Jede Reihe sollte eine eindeutige ID haben Ich füge normalerweise die Reihennummer zur Identifikation hinzu

+0

danke für Ihre Antwort, ich tat, was Sie sagten und änderte die Identifikation aber unglücklicherweise habe ich noch das selbe probleme –

Verwandte Themen