File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Facing Problem in JSF form SelectItem[]

 
Ankit Thakkar
Ranch Hand
Posts: 33
Android Java Mac PPC
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ALL,

I am working in Combobox in JSF, I am setting data of combo from database,

1)
JSP Part is :
<h:selectOneMenu styleClass="selectOneMenu" id="menu1"
value="#{pc_Index.selectedData}">
<f:selectItems value="#{pc_Index.listData}"/>
</h:selectOneMenu>

Backing Bean :
I am getting SelectItem[] from Method getData,
SelectItem[] listData = getData();

But I am getting error like :
java.lang.IllegalArgumentException: "{2}" Conversion Error setting value ''{0}'' for ''{1}''


2)
Now when I am doing same thing using ArrayList then it working fine.

JSP Part is :
<h:selectOneMenu styleClass="selectOneMenu" id="menu1"
value="#{pc_Index.selectedData}">
<f:selectItems value="#{pc_Index.arrayList}"/>
</h:selectOneMenu>

Backing Bean :
I am getting SelectItem[] from Method getData,
I am explicitly converting SelectItem[] into ArrayList means I am adding one SelectItem at a time from for loop to arrayList.
So It is working fine in JSP.

Can anybody have any idea regarding this error, Am I doing something wrong in my code?
Please reply ASAP.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Bunty",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

thanks,
Dave
 
Ankit Thakkar
Ranch Hand
Posts: 33
Android Java Mac PPC
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya David, I have updated my Profile.
 
Sajan Patel
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I am getting error like :
java.lang.IllegalArgumentException: "{2}" Conversion Error setting value ''{0}'' for ''{1}''


Normally, This error occur when your list object is NULL.
Try debug statement on getter method to see is it been called or not.
 
Paul Swarnapandian
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem could be that you have not mapped the bean properly in faces-config.xml
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic