File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Unknown validator id in JSF2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Unknown validator id in JSF2" Watch "Unknown validator id in JSF2" New topic

Unknown validator id in JSF2

Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 171

Hi All,

I'm invoking .xhtml page which is constructed by JSF2 with custom validation attached, but error occurs as "Unknown validator id:". Used the @FacesValidator(value="validator_id"), but everything works fine if I do the configure in faces_config.xml. I've searched for it, end of up with none. Kindly help me on this.

Here is my java class file which implements validator interface,

xhtml file used the above validator class to validate one of the input field.

No pain, No gain.
OCJP 1.6, Liferay Certified Developer 6.1
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

I don't know what effect the "RequestScoped" attribute is having, but validators are not backing beans, although validator methods can be implements within backing beans. Remove the scope attribute.

You should be able to specify an unqualified "@FacesValidator" on the class definition and that would construct the default ID of "com.firstjsf2.EmailValidator" if my memory is accurate. And, of course, assuming that the bean is in the "com.firstjsf2" package.

An IDE is no substitute for an Intelligent Developer.
Marcos Vidolin

Joined: May 10, 2011
Posts: 28

Why don't you use the Bean Validation (JSR 303)? Are you using Java EE 6?

I agree. Here's the link:
subject: Unknown validator id in JSF2
It's not a secret anymore!