• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JSF Validation not working

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to do the validation using JSF validator interface.
For some reason the control is not reaching m y validator code at all.
I tried a system.out inside the method and its not printing out.
Any help is appreciated!

Here is my code:

public class MyValidator implements Validator {
public void validate(FacesContext context, UIComponent uiComponent,
Object object) throws ValidatorException {
System.out.println("in the validator method");
validateSomething(context, uiComponent, object);
}


In the faces-config i have
<validator>

<validator-id>MyValidator</validator-id>

<validator-class>
com.abc.MyValidator
</validator-class>

</validator>

In the JSP i have
<TD class="textBoxNew">
<h:inputText id="text1" value="#{UserBean.field1}" >
<f:validator validatorId="MyValidator"/></h:inputText>
</TD>

Am i doing anything wrong here?
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic