{"id":611,"date":"2011-10-21T17:18:00","date_gmt":"2011-10-21T17:18:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/parametrizing-custom-validator-in-jsf-2.html"},"modified":"2012-10-21T20:25:43","modified_gmt":"2012-10-21T20:25:43","slug":"parametrizing-custom-validator-in-jsf-2","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html","title":{"rendered":"Parametrizing custom validator in JSF 2"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">Writing a custom validator in JSF 2 is not a complicated task. You implement <em>Validator<\/em> interface, add <em>@FacesValidator<\/em> annotation and insert validator declaration in <em>faces-config.xml<\/em>, that\u2019s all. A piece of cake. But let\u2019s consider following scenario:<\/p>\n<p>You need custom date validator, let\u2019s say checking that date from <em>rich:calendar<\/em> is not in the past. So we place calendar component with validator inside.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;rich:calendar value=\"#{fieldValue}\" id=\"dateField\" datePattern=\"yyyy\/MM\/dd\"&gt;\r\n        &lt;f:validator validatorId=\"dateNotInThePast\"\/&gt;\r\n    &lt;\/rich:calendar&gt;\r\n<\/pre>\n<p>And our  validator could look like below:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">@FacesValidator(\"dateNotInThePast\")\r\npublic class DateNotInThePastValidator implements Validator {\r\n\r\n  @Override\r\n  public void validate(FacesContext facesContext, UIComponent uiComponent, Object value)\r\n                                                              throws ValidatorException {\r\n    if (ObjectUtil.isNotEmpty(value)) {\r\n      checkDate((Date)value, uiComponent, facesContext.getViewRoot().getLocale());\r\n    }\r\n  }\r\n\r\n  private void checkDate(Date date, UIComponent uiComponent, Locale locale) {\r\n    if(isDateInRange(date) == false) {\r\n      ResourceBundle rb = ResourceBundle.getBundle(\"messages\", locale);\r\n      String messageText = rb.getString(\"date.not.in.the.past\");\r\n      throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,\r\n                                     messageText, messageText));\r\n    }\r\n  }\r\n\r\n  private boolean isDateInRange(Date date) {\r\n    Date today = new DateTime().withTime(0, 0, 0, 0).toDate();\r\n    return date.after(today) || date.equals(today);\r\n  }\r\n}\r\n<\/pre>\n<p>And if we provide key value in properties file we will see something like this:<\/p>\n<div class=\"separator\" style=\"clear: both;text-align: center\"><a href=\"http:\/\/tomaszdziurko.pl\/wp-content\/uploads\/2011\/10\/validator_1.png\"><img decoding=\"async\" alt=\"\" class=\"aligncenter size-full wp-image-1001\" height=\"146\" src=\"http:\/\/tomaszdziurko.pl\/wp-content\/uploads\/2011\/10\/validator_1.png\" width=\"410\" \/><\/a><\/div>\n<p>So it looks that we have working and production-ready custom validator.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3 style=\"text-align: left\">  The problem<\/h3>\n<p>But while our form becomes more and more complex we might encouter issue described on the screen below:<\/p>\n<div class=\"separator\" style=\"clear: both;text-align: center\"><a href=\"http:\/\/tomaszdziurko.pl\/wp-content\/uploads\/2011\/10\/validator_21.png\"><img decoding=\"async\" alt=\"\" class=\"aligncenter size-full wp-image-1003\" height=\"132\" src=\"http:\/\/tomaszdziurko.pl\/wp-content\/uploads\/2011\/10\/validator_21.png\" width=\"381\" \/><\/a><\/div>\n<p>So the problem is how user can determine which date is valid and which is not? Our validator uses the same property key to display both error messages.<\/p>\n<h3 style=\"text-align: left\">  The solution<\/h3>\n<p>We need to somehow provide a label of validated field to our custom validator. And, suprisingly for JSF, it can be achieved pretty easily. The only catch is that you have to know how to do it <img decoding=\"async\" alt=\":)\" class=\"wp-smiley\" src=\"http:\/\/tomaszdziurko.pl\/wp-includes\/images\/smilies\/icon_smile.gif\" \/> <\/p>\n<p>So in Java Server Faces we could parametrize components with attributes (<em>f:attribute<\/em> tag). So we add attribute to rich:calendar and then read this passed value value inside validator assigned to this calendar field.&nbsp;So now our calendar components should look like that:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;rich:calendar value=\"#{fieldValue}\" id=\"dateField\" datePattern=\"yyyy\/MM\/dd\"&gt;\r\n        &lt;f:validator validatorId=\"dateNotInThePast\"\/&gt;\r\n        &lt;f:attribute name=\"fieldLabel\" value=\"Date field 2\" \/&gt;\r\n    &lt;\/rich:calendar&gt;\r\n<\/pre>\n<p>And in our validator Java class we could get this value using <em>uiComponent.getAttributes().get(\u201cfieldLabel\u201d);<\/em><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">private void checkDate(Date date, UIComponent uiComponent, Locale locale) {\r\n        if(isDateInRange(date) == false) {\r\n            ResourceBundle rb = ResourceBundle.getBundle(\"messages\", locale);\r\n            String messageText = getFieldLabel(uiComponent) +\" \" + rb.getString(getErrorKey());\r\n\r\n            throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,\r\n                                            messageText, messageText));\r\n        }\r\n    }\r\n\r\n    protected String getFieldLabel(UIComponent uiComponent) {\r\n        String fieldLabel = (String) uiComponent.getAttributes().get(\"fieldLabel\");\r\n\r\n        if(fieldLabel == null) {\r\n            fieldLabel = \"Date\" ;\r\n        }\r\n\r\n        return fieldLabel;\r\n    }\r\n<\/pre>\n<p>Our property value for error should have value <em>can not be in the past<\/em> as <em>Date<\/em> or field label will be added at the beginning of error message.<\/p>\n<p>And working example should show something similar to this screen:<\/p>\n<div class=\"separator\" style=\"clear: both;text-align: center\"><a href=\"http:\/\/tomaszdziurko.pl\/wp-content\/uploads\/2011\/10\/validator_3.png\"><img decoding=\"async\" alt=\"\" class=\"aligncenter size-full wp-image-1020\" height=\"132\" src=\"http:\/\/tomaszdziurko.pl\/wp-content\/uploads\/2011\/10\/validator_3.png\" width=\"381\" \/><\/a><\/div>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/tomaszdziurko.pl\/2011\/10\/parametrizing-custom-validator-jsf-2\/\">Parametrizing custom validator in JSF 2<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a>&nbsp;<a href=\"http:\/\/tomaszdziurko.pl\/whoami\/\">Tomasz Dziurko<\/a> at the <a href=\"http:\/\/tomaszdziurko.pl\/\">Code Hard Go Pro<\/a>&nbsp;blog<\/p>\n<p><strong><i>Related Articles :<\/i><\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/10\/java-ee-past-present-cloud-7.html\">Java EE Past, Present, &amp; Cloud 7<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/10\/jboss-as-702-arc-released-playing-with.html\">JBoss AS 7.0.2 &#8220;Arc&#8221; released &#8211; Playing with bind options<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/08\/those-evil-frameworks-and-their.html\">Those evil frameworks and their complexity<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/09\/real-modular-web-applications-why-there.html\">Real modular web applications: Why there is no standard for developing them?<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/10\/programming-antipatterns.html\">Programming antipatterns<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/p\/java-tutorials.html\">Java Tutorials and Android Tutorials list<\/a> <\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Writing a custom validator in JSF 2 is not a complicated task. You implement Validator interface, add @FacesValidator annotation and insert validator declaration in faces-config.xml, that\u2019s all. A piece of cake. But let\u2019s consider following scenario: You need custom date validator, let\u2019s say checking that date from rich:calendar is not in the past. So we &hellip;<\/p>\n","protected":false},"author":71,"featured_media":174,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[293,292],"class_list":["post-611","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jsf","tag-validators"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Parametrizing custom validator in JSF 2 - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Writing a custom validator in JSF 2 is not a complicated task. You implement Validator interface, add @FacesValidator annotation and insert validator\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Parametrizing custom validator in JSF 2 - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Writing a custom validator in JSF 2 is not a complicated task. You implement Validator interface, add @FacesValidator annotation and insert validator\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2011-10-21T17:18:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-21T20:25:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tomasz Dziurko\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tomasz Dziurko\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html\"},\"author\":{\"name\":\"Tomasz Dziurko\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9ec08ee64ace4c16c8b8c8bf6339b25f\"},\"headline\":\"Parametrizing custom validator in JSF 2\",\"datePublished\":\"2011-10-21T17:18:00+00:00\",\"dateModified\":\"2012-10-21T20:25:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html\"},\"wordCount\":353,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jsf-logo.jpg\",\"keywords\":[\"JSF\",\"Validators\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html\",\"name\":\"Parametrizing custom validator in JSF 2 - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jsf-logo.jpg\",\"datePublished\":\"2011-10-21T17:18:00+00:00\",\"dateModified\":\"2012-10-21T20:25:43+00:00\",\"description\":\"Writing a custom validator in JSF 2 is not a complicated task. You implement Validator interface, add @FacesValidator annotation and insert validator\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jsf-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jsf-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/10\\\/parametrizing-custom-validator-in-jsf-2.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Parametrizing custom validator in JSF 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9ec08ee64ace4c16c8b8c8bf6339b25f\",\"name\":\"Tomasz Dziurko\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g\",\"caption\":\"Tomasz Dziurko\"},\"sameAs\":[\"http:\\\/\\\/tomaszdziurko.pl\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Tomasz-Dziurko\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Parametrizing custom validator in JSF 2 - Java Code Geeks","description":"Writing a custom validator in JSF 2 is not a complicated task. You implement Validator interface, add @FacesValidator annotation and insert validator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html","og_locale":"en_US","og_type":"article","og_title":"Parametrizing custom validator in JSF 2 - Java Code Geeks","og_description":"Writing a custom validator in JSF 2 is not a complicated task. You implement Validator interface, add @FacesValidator annotation and insert validator","og_url":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2011-10-21T17:18:00+00:00","article_modified_time":"2012-10-21T20:25:43+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","type":"image\/jpeg"}],"author":"Tomasz Dziurko","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Tomasz Dziurko","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html"},"author":{"name":"Tomasz Dziurko","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9ec08ee64ace4c16c8b8c8bf6339b25f"},"headline":"Parametrizing custom validator in JSF 2","datePublished":"2011-10-21T17:18:00+00:00","dateModified":"2012-10-21T20:25:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html"},"wordCount":353,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","keywords":["JSF","Validators"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html","url":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html","name":"Parametrizing custom validator in JSF 2 - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","datePublished":"2011-10-21T17:18:00+00:00","dateModified":"2012-10-21T20:25:43+00:00","description":"Writing a custom validator in JSF 2 is not a complicated task. You implement Validator interface, add @FacesValidator annotation and insert validator","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2011\/10\/parametrizing-custom-validator-in-jsf-2.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Parametrizing custom validator in JSF 2"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9ec08ee64ace4c16c8b8c8bf6339b25f","name":"Tomasz Dziurko","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g","caption":"Tomasz Dziurko"},"sameAs":["http:\/\/tomaszdziurko.pl\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Tomasz-Dziurko"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=611"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/611\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/174"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}