• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validation Problems on f:selectItems selection

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am relatively new to JSF 2.0 and struggle around with Validation in my case.

my Facelet:




in my backing bean:


the validation problem:


Translation to english: The selected value is invalid

Btw: Bundesland stands for one of 9 organizational areas within Austria. Arbeitsgeber means employee.
Sorry for this horrible language mixture.

Anybody any ideas? I am running out of them

thanks in advance,
Andi

Edit: fixed a typo and added a translation to the error message.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andi,

Can you translate the error message to english? It may allow more people to try to help troubleshoot the error.
 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ups! if I remember correctly it stand's for: invalid value
I will check in my office tomorrow.

greets

Edit: fixed type. iPhone touchkeybordes 5 minutes before falling asleep can be tricky ;)
 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I checked now. The translation to english: The selected value is invalid

I also added the translation to the original posting.
 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found the problem

I initialized the select items with the enum values, but I should have used the string representation of them.

The solution is:

Maybe this helps somebody else.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I think your real problem was that your "set" method originally took the entire SelectItem as a parameter. It should have taken a variable of the enum type.

You can create a SelectItem sequence that consists of (enum, String) pairs and I do it sometimes. You just have to do it using the proper set/get method signatures. But converting the enum to its string equivalents will work.
 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot!

Works now like a charme
reply
    Bookmark Topic Watch Topic
  • New Topic