File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Validation Error: Value is not valid Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Validation Error: Value is not valid " Watch "Validation Error: Value is not valid " New topic

Validation Error: Value is not valid

A Saari

Joined: Mar 31, 2006
Posts: 26
hi all

i'm getting the above error on a submit using a h:selectManyListbox

i build my list of SelectItems(myObject,myLabel) where myObject class overrides the equals() method:

public boolean equals( Object o )
// do some stuff
return true;

but the equals() method is never called - anyone know why?

i also implemented javax.faces.validator.Validator;
and the method

public void validate(FacesContext facesContext,
UIComponent uiComponent,
Object o) throws ValidatorException {

which does get called. i just return without throwing a

Can anyone tell me why the 'Validation Error: Value is not valid' is being thrown - and from where?

Jeremy Wilson
Ranch Hand

Joined: Feb 18, 2003
Posts: 166
Does your myObject class extend the SelectItem class. I believe this is a must.

Jeremy Wilson
A Saari

Joined: Mar 31, 2006
Posts: 26
No. So I added that in

public class ProjectsList extends javax.faces.model.SelectItem {

the equals method still is not called and i get the

same validation error - i appreciate the thought though ...

A Saari

Joined: Mar 31, 2006
Posts: 26

The class I was sending to the new SelectItem(myClass,myLabel) had an Integer as the projectID. I changed that to a String. Tossed out my custom converter, tossed out my validator. Made sure myClass extends SelectItem

public class ProjectsListItem extends javax.faces.model.SelectItem implements {

then I added <managed-property tag to the managed bean


and it works. No validation error. I think the response was sending a String and decode() for the component was trying to find/convert its value and I was getting a validation error because my list of SelectItems (projectsList) contained a class that had an Integer projectID rather than a String.

zel branco

Joined: Jan 04, 2008
Posts: 3
I got this error because I was adding "mixed data type" in to key
value of "SelectItem"..
ie I was adding "" - String - and adding the rest of the values as "Long".
I agree. Here's the link:
subject: Validation Error: Value is not valid
It's not a secret anymore!