{"id":66433,"date":"2021-07-19T04:10:05","date_gmt":"2021-07-19T08:10:05","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/jsf-lesson-6-validating-user-input-in-jsf-java-short-notes\/"},"modified":"2021-07-19T04:10:05","modified_gmt":"2021-07-19T08:10:05","slug":"jsf-lesson-6-validating-user-input-in-jsf-java-short-notes","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=66433","title":{"rendered":"JSF: Lesson &#8211; 6: Validating User Input in JSF #Java Short Notes"},"content":{"rendered":"<ul>\n<li> Target: Intermediate level web-developers.      <\/li>\n<li> <a href='codes\/jsf\/validation.rar'>Sample application for this article<\/a>      <\/li>\n<li> <a href='http:\/\/www.justetc.net\/knowledge\/multimedia_training\/displayArticle.php?table=TrainingVideos&amp;articleID=10'>Video Tutorial for this article<\/a>     <\/li>\n<li> In web-application development, validating user inputs           takes much efforts. JSF has made validations much easier than usual      <\/li>\n<li> JSF Built-in Validators:\n<ul>\n<li> validateDoubleRange: Checks that the value provided is a double value. You can also set a minimum and a maximum.           <\/li>\n<li> validateLongRange: Validates the input to be a long. It also has the optional minimum and maximum parameters.           <\/li>\n<li> validateLength: Validates the length of a string        <\/li>\n<li> Without the minimum and the maximum values these validators actually do nothing       <\/li>\n<\/ul>\n<\/li>\n<li> You can also enforce a value as follows. If no value is provided, an error message is displayed\n<pre><\/pre>\n<\/li>\n<li> You can also create your own custom validator that should implement javax.faces.validator.Validator interface.<\/li>\n<li> You have to implement the validate() method: validate(FacesContext arg0, UIComponent arg1, Object arg2)    throws ValidatorException<\/li>\n<li> In the error condition, you should throw ValidatorException from the validate method<\/li>\n<li> Then you need to register the custom validator in the faces-config.xml file using a id as follows:\n<pre>    currency.validator    net.justetc.jsf.CurrencyValidator  <\/pre>\n<\/li>\n<li> From your JSP, you can refer to the validator as follows:<\/li>\n<li>\n<pre>                                        <\/pre>\n<\/li>\n<\/ul>\n<p> From: http:\/\/sitestree.com\/?p=4997<br \/> Categories:Java Short Notes<br \/>Tags:<br \/> Post Data:2012-05-25 08:43:55<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Target: Intermediate level web-developers. Sample application for this article Video Tutorial for this article In web-application development, validating user inputs takes much efforts. JSF has made validations much easier than usual JSF Built-in Validators: validateDoubleRange: Checks that the value provided is a double value. You can also set a minimum and a maximum. validateLongRange: Validates &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=66433\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-66433","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":66423,"url":"http:\/\/bangla.sitestree.com\/?p=66423","url_meta":{"origin":66433,"position":0},"title":"JSF: Lesson &#8211; 1: JSF Specifications #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 19, 2021","format":false,"excerpt":"Video Demonstration of a sample JSF application create: Read the article first JSF Specifications JSF is not standalone technology, you have to use it in conjunction with JSPs, Servlets, EJBs How to use JSF with Servlets and EJBs: In Servlet or EJB, explicitly create instances of UI components and use\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":66425,"url":"http:\/\/bangla.sitestree.com\/?p=66425","url_meta":{"origin":66433,"position":1},"title":"JSF: Lesson &#8211; 2: JSF Managed Beans #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 19, 2021","format":false,"excerpt":"Codes for this article Video Demonstration for this article Target: Intermediate level programmers and web-developers. Any programmer\/web-developer can take a look. Pre-requisite: HTML, JSP, Servlet, Tomcat, J2EE, MVC, and JSF Introduction. Check the corresponding sections of this web-site, to have an idea on the required technology knowledge Pre-requisite: Download this\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":74778,"url":"http:\/\/bangla.sitestree.com\/?p=74778","url_meta":{"origin":66433,"position":2},"title":"JSF: Java Server Faces Short Notes from the past","author":"Sayed","date":"May 31, 2022","format":false,"excerpt":"JSF: Java Server Faces Short Notes from the past http:\/\/bangla.salearningschool.com\/recent-posts?s=jsf Data conversion in jsf applications 2022\/04\/15 at 10:01 am 0 views Select internationalization in jsf #AngularJS #By Sayed Ahmed internationalization in jsf #AngularJS #By Sayed Ahmed 2021\/08\/02 at 4:10 am 0 views Select data conversion in jsf applications #AngularJS #By\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":66435,"url":"http:\/\/bangla.sitestree.com\/?p=66435","url_meta":{"origin":66433,"position":3},"title":"JSF: Lesson &#8211; 7: Using Message Bundles in JSF: Support Internationalization #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 19, 2021","format":false,"excerpt":"Target: Intermediate level web-developers (Java-platform). Sample application on Internationalization with JSF Video Tutorial on Internationalization with JSF To support Internationalization, in the web-pages, the text messages and the control texts make use of the keys for the values\/messages. In the value fields, keys are mentioned\/provided as the values. Later, based\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":66431,"url":"http:\/\/bangla.sitestree.com\/?p=66431","url_meta":{"origin":66433,"position":4},"title":"JSF: Lesson &#8211; 5: Converting Data #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 19, 2021","format":false,"excerpt":"Sample application for JSF Data Type Converter Video Tutorial for JSF Data Type Converter Pre-requisite: JSF Lesson 1, 2, 3, 4 JSF provides two different types of built-in data type converters such as: String and Date Conversion, Number and String Conversion. Related tags: f:convertDateTime, f:convertNumber, f:converter In our previous examples,\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":66427,"url":"http:\/\/bangla.sitestree.com\/?p=66427","url_meta":{"origin":66433,"position":5},"title":"JSF: Lesson &#8211; 3: Controlling Page Navigation in JSF #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 19, 2021","format":false,"excerpt":"Sample application for this article Video Tutorial for this article Pre-requisite: JSF Lesson 1 & 2 Navigation: Two Types: Static: The destination page is fixed Dynamic: The destination page varies with the conditions Static Static: You provide a fixed value for the \"action\" attribute for a JSF event control\/action element\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/66433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66433"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/66433\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66433"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}