2017-03-06 14 views
0

iceface api를 사용하는 프로젝트에서 작업하고 있습니다. 문제가 발생했습니다. 행의 개체를 delet하는 dataTable에서 commandButton을 사용했지만 서버를 클릭하면 서버가 멈추고 유지됩니다 콘솔에 오류를 표시하지 않고로드.데이터 테이블 내에서 commandbutton 작업 후 페이지가 멈 춥니 다

사용하여 아파치 - 톰캣-7.0.75

내 HTML 코드 :

<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>

내 콩 :

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 
 
}

답변

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> 

중복 ID로 인해 발생할 수 있습니다. 여기에 중복 된 이름이 있습니다. f : param name = "id"렌더링 될 때 중복 ID를 사용하여 중복 ID가 없는지 확인합니다. 각 행에는 고유 한 ID가 있어야합니다. 일반적으로 ID에 행 번호를 추가합니다.

+0

답변을 주셔서 감사합니다. 나는 말했던 바를 말했고 ID를 변경했지만 유감스럽게도 여전히 동일한 문제가 있습니다. –