2017-02-22 36 views
0

検証エラーが発生しました:値が有効なエラーではありません。私はその問題をequalsメソッドと特定しました。選択されたオブジェクトは引数として正しく渡されますが、何らかの理由で比較されるエンティティが間違っています。ここでh:selectOneListBox検証エラー:値が有効ではありません

<div class="col-sm-8"> 
      <h:selectOneListbox id="${cc.attrs.id}_test" converter="#{cc.attrs.converter}" 
           size="#{cc.attrs.selector.selectedList.size()+1}" style="height: 150px" 
           value="#{cc.attrs.selector.removeItem}" styleClass="form-control"> 
      <f:selectItems value="#{cc.attrs.selector.selectedList}" var="test" 
          itemValue="#{test}" 
          itemLabel="#{test.displayName}" /> 
      <f:ajax event="change" render="${cc.attrs.id}_jts_panel ${cc.attrs.id}_legend" /> 
      </h:selectOneListbox> 
</div> 

は、equalsメソッドです:何らかの理由で今

@Override 
    public boolean equals(Object object) 
    { 
    if (!(object instanceof ObjectTest)) 
    { 
     return false; 
    } 

    ObjectTest other = (ObjectTest) object; 

    if (this.attribute1 == null || this.attribute2 == null) { 
     return false; 
    } 

    if (other.attribute1 == null || other.attribute2 == null) { 
     return false; 
    } 

    if ((this.attribute1.getName() == null && other.attribute1.getName() != null) || (this.attribute1.getName() != null && !this.attribute1.getName().equals(other.attribute1.getName()))) 
    { 
     return false; 
    } 
    if ((this.attribute2.getName() == null && other.attribute2.getName() != null) || (this.attribute2.getName() != null && !this.attribute2.getName().equals(other.attribute2.getName()))) 
    { 
     return false; 
    } 
    return true; 
    } 

、this.attribute1.getNameは())(other.attribute1.getNameとは異なります。 equalsメソッドに渡されたオブジェクトは正しいものですが、エンティティ自体は渡されたオブジェクトとは異なるものです。これはequalsメソッドがあるエンティティクラスなので、this.attributeの値はどのように取得されますか?私は何か間違っているのですか?私が追加したコメントは、あなたの問題を解決し、あなたはそれを追加するように依頼するので

+0

私の推測では、コンバーターがあなたの問題を引き起こしているということです: 'converter ="#{cc.attrs.converter} "'これは何を評価するのですか? –

+0

あなたは正しいホルヘです。私はそれを正しいものとして受け入れることができるように、以下の回答として返信を追加できますか?そしてありがとう。 –

+0

完了します。あなたが尋ねたように、解説としてコメントを追加しました。それがあなたを助けてくれてうれしいです。 :) –

答えて

1

、ここにある:

問題は、使用しているコンバータによって引き起こされた:あなたの問題を理解することはあまり

converter="#{cc.attrs.converter}" 
関連する問題