Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Regex Validator  RSS feed

 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to write a custom validator which can accept the regex expression as an attribute. Can anybody please point me to the right resource or ideas?

 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSF, custom validators are handled in the Java code, not in attributes.

In terms of resources, I like the The Complete Reference JavaServer Faces by Schalk/Burns. It's got a good section on validators and how to create custom ones.
 
Cesar Loachamin
Ranch Hand
Posts: 90
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mary

Since JSF 2.0 you have a core tag f:validateRegex that accept and validate from a regex expression, you have to set the pattern attribute to use it.
I hope this help you with your problem
Regards
Cesar
 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if you want to go all 2.0 about it...

(I'm a 1.2 kinda guy.)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!