Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JSF and JQuery - error with selectOneListBox  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my application I have two list boxes (selectOneListBox) one representing available values (pre populated) and one representing selected values (empty). Both list boxes are have the f:selectItems tag which is bound to a variable in the backing bean. When I choose a value from the Available list and click on the "add" button, I use JQuery to transfer the selected item from the Available list to the Selected List. All this works fine.

However when I click on the save button (h:commandButton) my application goes through the various life cycle phases and when it reaches the process validation phase, it performs a SelectItemsIterator on both Lists but fails on the Selected List with the error "NoSuchElementException()" since it was initially empty. I initialized the List Boxes as follows.




I have tried initializing the Map to have an empty key and value pair, but when I run the application,
the list item contains an empty entry, and that is also allowed to be moved between lists when I add to or remove from the Selected List.

I would like to know if there is a way to bypass the list validation.

All I require is that After I transfer the Items from Available List to Selected List and hit submit, I need to be able to access the List items in the backing bean. If you have a work around to my problem stated above or if you have a completely different approach in handling this problem I would be really happy to hear from you. thanks for your replies in advance.

Regards,
Amar Mahtani
 
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this for information on why using phrases like "urgent" can cause your post to be ignored. I have removed it from your subject for you.
 
amar mahtani
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear for the suggestion.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!