2011-07-15 14 views
0

JSF2.0/Primefacesを使用していますが、selectManyListboxには要素(プロジェクト名)が含まれています。これらの要素を復習し、selectManyListbox 。selectManyListboxからアイテムを回復しようとするとエラーが発生する

まず、私は私の最初のselectManyListboxを記入し、選びだしアイテムを回復することを試みたが、エラーがoccure:

マイJSF:

<h:selectManyListbox size="3" value="#{TestAjax.selectedProjects} "> 
     <f:selectItems value="#{TestAjax.getMyListProject()}" /> 
    </h:selectManyListbox> 

マイ豆:

private List<String> selectedProjects; // + getter + setter 
private List<SelectItem> MyListproject; 

    public List<SelectItem> getMyListProject() { 
     FindProject fproj =new FindProject(); 
      if (MyListproject == null) { 
      MyListproject = new ArrayList<SelectItem>(); 
      for (String val : fproj.FindListprojects()) { 
     MyListproject.add(new SelectItem(val)); 
     } 
    } 
return MyListproject; 
} 

誤差があるが:

javax.faces.FacesException: Target model Type is no a Collection or Array 
at  com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValuesForModel(MenuRenderer.java:392) 
at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValue(MenuRenderer.java:129) 
at com.sun.faces.renderkit.html_basic.MenuRenderer.getConvertedValue(MenuRenderer.java:315) 
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030) 
at javax.faces.component.UIInput.validate(UIInput.java:960) 
at javax.faces.component.UIInput.executeValidate(UIInput.java:1233) 
at javax.faces.component.UIInput.processValidators(UIInput.java:698) 
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) 
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) 
at javax.faces.component.UIForm.processValidators(UIForm.java:253) 
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) 
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) 
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1172) 
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) 
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 

UPDATE:サイズ= "3" value属性の後に次のようになります。

を解決 問題は、それがweard間違いでした!

+0

42%受け入れ率? –

+0

良いあなたは問題を発見した。ご質問ください。 –

+0

「回復する」とはどういう意味ですか?私は2日前にこの質問を見ましたが、あなたが話していたことを全く知らなかったので答えなかったのです。エキゾチックでない言葉を使用して、英語以外のネイティブも質問を理解できるようにしてください。 – BalusC

答えて

0

PDATE:問題は、それは間違いだったweard

を解決:サイズ= "3" は、value属性の後でなければなりません!

+0

Mojarra 2.1.1でこの問題を再現できません。どのようなJSF impl/versionを使用していますか? – BalusC

関連する問題