{"id":34622,"date":"2016-03-09T15:00:45","date_gmt":"2016-03-09T13:00:45","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=34622"},"modified":"2019-04-09T13:23:32","modified_gmt":"2019-04-09T10:23:32","slug":"vaadin-form-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/","title":{"rendered":"Vaadin Form Example"},"content":{"rendered":"<p>In this example I am going to show you how to make a Vaadin form. A form is a common HTML element to collect user input and send the data to a server, most of the time using the POST http method.<\/p>\n<h2>1. The tools<\/h2>\n<ul>\n<li>Java JDK 8<\/li>\n<li>Latest Eclipse Mars<\/li>\n<li>Vaadin 7.6.3<\/li>\n<li>Tomcat Server 8<\/li>\n<\/ul>\n<h2>2. Introduction<\/h2>\n<p>Vaadin goes beyond the basic HTML form by adding field validation and data binding, in Vaadin you can make your form with Java code, validate the data and put the data into a Vaadin data source ready to send to the persistence layer of your application.<\/p>\n<h2>3. Prerequisites<\/h2>\n<ul>\n<li>JDK installed<\/li>\n<li>Eclipse Mars installed and working<\/li>\n<li>Vaadin 7.6.3 plugin installed<\/li>\n<li>Tomcat 8 installed and running<\/li>\n<\/ul>\n<h2>4. Set up the project<\/h2>\n<p>In the file menu choose File -&gt; New -&gt; Other:<\/p>\n<p><figure id=\"attachment_34378\" aria-describedby=\"caption-attachment-34378\" style=\"width: 646px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/01-New-Project-1.png\" rel=\"attachment wp-att-34378\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/01-New-Project-1.png\" alt=\"01 New Project\" width=\"646\" height=\"422\" class=\"size-full wp-image-34378\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/01-New-Project-1.png 646w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/01-New-Project-1-300x196.png 300w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/a><figcaption id=\"caption-attachment-34378\" class=\"wp-caption-text\">01 New Project<\/figcaption><\/figure><\/p>\n<p>Now from the list choose Vaadin 7 project:<\/p>\n<p><figure id=\"attachment_34379\" aria-describedby=\"caption-attachment-34379\" style=\"width: 524px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/02-Vaadin-Project-1.png\" rel=\"attachment wp-att-34379\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/02-Vaadin-Project-1.png\" alt=\"02 Vaadin Project\" width=\"524\" height=\"499\" class=\"size-full wp-image-34379\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/02-Vaadin-Project-1.png 524w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/02-Vaadin-Project-1-300x286.png 300w\" sizes=\"(max-width: 524px) 100vw, 524px\" \/><\/a><figcaption id=\"caption-attachment-34379\" class=\"wp-caption-text\">02 Vaadin Project<\/figcaption><\/figure><\/p>\n<p>Hit next and name your project then hit finish.<\/p>\n<h2>5. Coding the example<\/h2>\n<p>Edit the entry point Vaadin file in my case the autogenerated <code>VaadinFormUI.java<\/code> file, and inside the init method begin coding the example.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Create the layout<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t    final FormLayout layout = new FormLayout();\n\t    layout.setMargin(true);\n\t    setContent(layout);\n<\/pre>\n<p>I created a new <code>FormLayout<\/code>, called layout, enable the margins and set as the main content layout, I am going to use the form as the main content.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Property set<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t    PropertysetItem myfields = new PropertysetItem();\n\t    myfields.addItemProperty(\"name\", new ObjectProperty(\"\"));\n\t    myfields.addItemProperty(\"age\", new ObjectProperty(0));\n\t    myfields.addItemProperty(\"email\", new ObjectProperty(\"\"));\n<\/pre>\n<p>I created a property set to make the form data source, for every field in my form I created an item property associated with the field in the UI, in this example I have in my form the fields name, age and email.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Error label<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t    Label errLabel = new Label();\n<\/pre>\n<p>This label is used to show the validation errors of my form.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Name field<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t    TextField nameText = new TextField(\"Name\");\n\t    nameText.setValidationVisible(false);\n\t    nameText.setIcon(FontAwesome.AMBULANCE);\n\t    StringLengthValidator slv = new StringLengthValidator(\"The name must be 3-10 letters (was {0})\", 3, 10, true);\n\t    nameText.addValidator(slv);\n\t    layout.addComponent(nameText);\n<\/pre>\n<p>I created a text field called <code>nameText<\/code> with a caption &#8220;Name&#8221; then hide the validation feedback to manually use it later, set an icon to my text field from the Fontawesome package that is bundled with Vaadin, Fontawesome is a widely known open source toolkit to use lightweight css and font icons for web pages and other applications as well, you can get more information here <a href=\"https:\/\/fortawesome.github.io\/Font-Awesome\/\" target=\"_blank\" rel=\"noopener noreferrer\">Font Awesome<\/a> and you can use it out of the box without any configuration with Vaadin.<\/p>\n<p>I also created a <code>StringLengthValidator<\/code> that validate the text in the <code>nameText<\/code> field and ensure that the text have more that 3 characters and less that 10, then I added the validator to the field and add the field to the layout to show it.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Age field<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t    TextField ageText = new TextField(\"Age\");\n\t    ageText.setValidationVisible(false);\n\t    IntegerRangeValidator ir = new IntegerRangeValidator(\"Age must be between 21 and 30\", 21, 30);\n\t    ageText.addValidator(ir);\n\t    layout.addComponent(ageText);\n\n<\/pre>\n<p>In this field I have an <code>IntegerRangeValidator<\/code> that validate the field as an integer between 21 and 30 inclusive, the data source do the trick here with the integer value, if you don&#8217;t use a binded data-source you need to use a converter to make the field an integer before use the validator. I created the field, created the validator, add the validator to the field and the added the field to the layout.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline\"><em>Email field<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t    TextField emailText = new TextField(\"email\");\n\t    emailText.setValidationVisible(true);\n\t    emailText.setRequired(true);\n\t    EmailValidator ev = new EmailValidator(\"You must provide a valid email\");\n\t    emailText.addValidator(ev);\n\t    layout.addComponent(emailText);\n<\/pre>\n<p>With this field, I make the field required to force the user fill the field, this is an email field that need to be validated as a valid email, this is usually done with regular expressions but in this case you can use the validator that is provided out of the box with Vaadin.<\/p>\n<p><span style=\"text-decoration: underline\"><em>FieldGroup<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t    FieldGroup fieldGroup = new FieldGroup(myfields);\n\t    fieldGroup.bind(nameText, \"name\");\n\t    fieldGroup.bind(ageText, \"age\");\n\t    fieldGroup.bind(emailText, \"email\");\n<\/pre>\n<p>The <code>FieldGroup<\/code> make the bind between the fields and the data source <code>PropertysetItem<\/code> so you can have your fields directly connected into the data source, easy as you see.<\/p>\n<h2>6. The submit button<\/h2>\n<p><span style=\"text-decoration: underline\"><em>Submit button<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t    Button button = new Button(\"Submit\");\n\t    button.addClickListener(new Button.ClickListener()\n\t    {\n\t      public void buttonClick(ClickEvent event)\n\t      {\n\t        Boolean failed = false;\n\t        errLabel.setValue(\"\");\n              }\n            }\n<\/pre>\n<p>I created a button to validate and submit the form data, inside the click listener, I declared a variable to use in the validation process also clean the label that shows the errors in the form.<\/p>\n<h2>7. Inside the click listener<\/h2>\n<p><span style=\"text-decoration: underline\"><em>nameText validation<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t        try\n\t        {\n\t          nameText.validate();\n\t        }\n\t        catch (InvalidValueException e)\n\t        {\n\t          errLabel.setValue(\" - \" + e.getMessage());\n\t          nameText.setValidationVisible(true);\n\t          failed = true;\n\t        }\n<\/pre>\n<p>the validation process is done within a <code>try\/catch block<\/code>, the <code>nameText.validate();<\/code> checks for the validation rules previously added to the field and capture a <code>InvalidValueException<\/code>, if the field have an invalid value according to the definition then an exception is raised and captured in the <code>catch<\/code> block, in this case the error label is updated and the validation is set to visible to a better feedback to the user and <code>failed<\/code> is set to <code>true<\/code> for use later.<\/p>\n<p><span style=\"text-decoration: underline\"><em>ageText validation<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t        try\n\t        {\n\t          ageText.validate();\n\t        }\n\t        catch (Exception e)\n\t        {\n\t          errLabel.setValue(errLabel.getValue() + \" - \" + e.getMessage());\n\t          ageText.setValidationVisible(true);\n\t          failed = true;\n\t        }\n<\/pre>\n<p>Validates the age field using the defined rules, age must be between 21 and 30 inclusive.<\/p>\n<p><span style=\"text-decoration: underline\"><em>emailText Validate<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t        try\n\t        {\n\t          emailText.validate();\n\t        }\n\t        catch (InvalidValueException e)\n\t        {\n\t          String emsg = e.getMessage();\n\t          if(emsg == \"\")\n\t          {\n\t            emsg = \"email is required\";\n\t          }\n\t          errLabel.setValue(errLabel.getValue() + \" - \" + emsg);\n\t          failed = true;\n\t        }\n<\/pre>\n<p>The email field is required and must be a valid email, the email validator provided by Vaadin follows the rules according to RFC 822 that validates most of emails, not all but a lot of them, if you need most specific validation rules you can use a regex validator that also is build-in in Vaadin.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Success validation<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t        if (!failed)\n\t        {\n\t          Notification.show(\"Everythig is OK !\", Notification.Type.TRAY_NOTIFICATION);\n\t        }\n<\/pre>\n<p>Here I use the <code>Boolean failed;<\/code> declared inside the listener to check that all validations are ok and show a notification. In this place you know that the form data is validated with the rules.[ulp id=&#8217;YBvYYzEYBUrADqmI&#8217;]<\/p>\n<h2>8. The complete source code<\/h2>\n<p><span style=\"text-decoration: underline\"><em>VaadinformUI.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.vaadinform;\n\nimport javax.servlet.annotation.WebServlet;\n\nimport com.vaadin.annotations.Theme;\nimport com.vaadin.annotations.VaadinServletConfiguration;\nimport com.vaadin.data.Validator.InvalidValueException;\nimport com.vaadin.data.fieldgroup.FieldGroup;\nimport com.vaadin.data.util.ObjectProperty;\nimport com.vaadin.data.util.PropertysetItem;\nimport com.vaadin.data.validator.EmailValidator;\nimport com.vaadin.data.validator.IntegerRangeValidator;\nimport com.vaadin.data.validator.StringLengthValidator;\nimport com.vaadin.server.FontAwesome;\nimport com.vaadin.server.VaadinRequest;\nimport com.vaadin.server.VaadinServlet;\nimport com.vaadin.ui.Button;\nimport com.vaadin.ui.Button.ClickEvent;\nimport com.vaadin.ui.FormLayout;\nimport com.vaadin.ui.Label;\nimport com.vaadin.ui.Notification;\nimport com.vaadin.ui.TextField;\nimport com.vaadin.ui.UI;\n\n@SuppressWarnings(\"serial\")\n@Theme(\"vaadinform\")\npublic class VaadinformUI extends UI {\n\n\t@WebServlet(value = \"\/*\", asyncSupported = true)\n\t@VaadinServletConfiguration(productionMode = false, ui = VaadinformUI.class)\n\tpublic static class Servlet extends VaadinServlet {\n\t}\n\n\t@Override\n\tprotected void init(VaadinRequest request) \n\t  {\n\t    final FormLayout layout = new FormLayout();\n\t    layout.setMargin(true);\n\t    setContent(layout);\n\n\t    PropertysetItem myfields = new PropertysetItem();\n\t    myfields.addItemProperty(\"name\", new ObjectProperty(\"\"));\n\t    myfields.addItemProperty(\"age\", new ObjectProperty(0));\n\t    myfields.addItemProperty(\"email\", new ObjectProperty(\"\"));\n\n\t    Label errLabel = new Label();\n\n\t    TextField nameText = new TextField(\"Name\");\n\t    nameText.setValidationVisible(false);\n\t    nameText.setIcon(FontAwesome.AMBULANCE);\n\t    StringLengthValidator slv = new StringLengthValidator(\"The name must be 3-10 letters (was {0})\", 3, 10, true);\n\t    nameText.addValidator(slv);\n\t    layout.addComponent(nameText);\n\n\t    TextField ageText = new TextField(\"Age\");\n\t    ageText.setValidationVisible(false);\n\t    IntegerRangeValidator ir = new IntegerRangeValidator(\"Age must be between 21 and 30\", 21, 30);\n\t    ageText.addValidator(ir);\n\t    layout.addComponent(ageText);\n\n\t    TextField emailText = new TextField(\"email\");\n\t    emailText.setValidationVisible(true);\n\t    emailText.setRequired(true);\n\t    EmailValidator ev = new EmailValidator(\"You must provide a valid email\");\n\t    emailText.addValidator(ev);\n\t    layout.addComponent(emailText);\n\n\t    FieldGroup fieldGroup = new FieldGroup(myfields);\n\t    fieldGroup.bind(nameText, \"name\");\n\t    fieldGroup.bind(ageText, \"age\");\n\t    fieldGroup.bind(emailText, \"email\");\n\n\t    Button button = new Button(\"Submit\");\n\t    button.addClickListener(new Button.ClickListener()\n\t    {\n\t      public void buttonClick(ClickEvent event)\n\t      {\n\t        Boolean failed = false;\n\t        errLabel.setValue(\"\");\n\t        try\n\t        {\n\t          nameText.validate();\n\t        }\n\t        catch (InvalidValueException e)\n\t        {\n\t          errLabel.setValue(\" - \" + e.getMessage());\n\t          nameText.setValidationVisible(true);\n\t          failed = true;\n\t        }\n\n\t        try\n\t        {\n\t          ageText.validate();\n\t        }\n\t        catch (Exception e)\n\t        {\n\t          errLabel.setValue(errLabel.getValue() + \" - \" + e.getMessage());\n\t          ageText.setValidationVisible(true);\n\t          failed = true;\n\t        }\n\n\t        try\n\t        {\n\t          emailText.validate();\n\t        }\n\t        catch (InvalidValueException e)\n\t        {\n\t          String emsg = e.getMessage();\n\t          if(emsg == \"\")\n\t          {\n\t            emsg = \"email is required\";\n\t          }\n\t          errLabel.setValue(errLabel.getValue() + \" - \" + emsg);\n\t          failed = true;\n\t        }\n\n\t        if (!failed)\n\t        {\n\t          Notification.show(\"Everythig is OK !\", Notification.Type.TRAY_NOTIFICATION);\n\t        }\n\t      }\n\t    });\n\t    layout.addComponent(button);\n\t    layout.addComponent(errLabel);\n\t  }\n}\n<\/pre>\n<h2>9. Running the example<\/h2>\n<p>Right click on the project folder and choose Run as -&gt; Run on server choose Tomcat 8 server and hit finish.<\/p>\n<h2>10. Results<\/h2>\n<p>All fields need to validate:<\/p>\n<p><figure id=\"attachment_34634\" aria-describedby=\"caption-attachment-34634\" style=\"width: 474px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/03-Validate-all-fields.png\" rel=\"attachment wp-att-34634\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/03-Validate-all-fields.png\" alt=\"03 Validate all fields\" width=\"474\" height=\"491\" class=\"size-full wp-image-34634\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/03-Validate-all-fields.png 474w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/03-Validate-all-fields-290x300.png 290w\" sizes=\"(max-width: 474px) 100vw, 474px\" \/><\/a><figcaption id=\"caption-attachment-34634\" class=\"wp-caption-text\">03 Validate all fields<\/figcaption><\/figure><\/p>\n<p>The email field needs validation:<\/p>\n<p><figure id=\"attachment_34635\" aria-describedby=\"caption-attachment-34635\" style=\"width: 474px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/04-Validate-email.png\" rel=\"attachment wp-att-34635\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/04-Validate-email.png\" alt=\"04 Validate email\" width=\"474\" height=\"491\" class=\"size-full wp-image-34635\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/04-Validate-email.png 474w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/04-Validate-email-290x300.png 290w\" sizes=\"(max-width: 474px) 100vw, 474px\" \/><\/a><figcaption id=\"caption-attachment-34635\" class=\"wp-caption-text\">04 Validate email<\/figcaption><\/figure><\/p>\n<p>Everything is ok:<\/p>\n<p><figure id=\"attachment_34636\" aria-describedby=\"caption-attachment-34636\" style=\"width: 476px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/05-Everithing-validated.png\" rel=\"attachment wp-att-34636\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/05-Everithing-validated.png\" alt=\"05 Everything validated\" width=\"476\" height=\"493\" class=\"size-full wp-image-34636\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/05-Everithing-validated.png 476w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/05-Everithing-validated-290x300.png 290w\" sizes=\"(max-width: 476px) 100vw, 476px\" \/><\/a><figcaption id=\"caption-attachment-34636\" class=\"wp-caption-text\">05 Everything validated<\/figcaption><\/figure><\/p>\n<h2>11. Download the Source Code<\/h2>\n<p>This was an example about Vaadin Form.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the Eclipse project here: <strong><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/03\/VaadinForm.zip\">VaadinForm<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example I am going to show you how to make a Vaadin form. A form is a common HTML element to collect user input and send the data to a server, most of the time using the POST http method. 1. The tools Java JDK 8 Latest Eclipse Mars Vaadin 7.6.3 Tomcat Server &hellip;<\/p>\n","protected":false},"author":77,"featured_media":33079,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1358],"tags":[],"class_list":["post-34622","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vaadin"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Vaadin Form Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this example I am going to show you how to make a Vaadin form. A form is a common HTML element to collect user input and send the data to a server,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Vaadin Form Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this example I am going to show you how to make a Vaadin form. A form is a common HTML element to collect user input and send the data to a server,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-09T13:00:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-09T10:23:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-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=\"Jesus Boadas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@jboadas\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jesus Boadas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/\"},\"author\":{\"name\":\"Jesus Boadas\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/506f9c2b38156c7f94bba77757206dd7\"},\"headline\":\"Vaadin Form Example\",\"datePublished\":\"2016-03-09T13:00:45+00:00\",\"dateModified\":\"2019-04-09T10:23:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/\"},\"wordCount\":882,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\",\"articleSection\":[\"Vaadin\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/\",\"name\":\"Vaadin Form Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\",\"datePublished\":\"2016-03-09T13:00:45+00:00\",\"dateModified\":\"2019-04-09T10:23:32+00:00\",\"description\":\"In this example I am going to show you how to make a Vaadin form. A form is a common HTML element to collect user input and send the data to a server,\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Vaadin\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/vaadin\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Vaadin Form Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/506f9c2b38156c7f94bba77757206dd7\",\"name\":\"Jesus Boadas\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Jesus-Boadas_avatar_1476120926-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Jesus-Boadas_avatar_1476120926-96x96.jpg\",\"caption\":\"Jesus Boadas\"},\"description\":\"I'm a self taught programmer, I began programming back in 1991 using an IBM A10 mainframe with Pascal an Assembler IBM 360\/70 emulator and Turbo C on a X86 PC, since that I work for the banking industry with emerging technologies like Fox Pro, Visual Fox Pro, Visual Basic, Visual C++, Borland C++, lately I moved out to the Airline industry, leading designing and programming in-house web applications with Flex, Actionscript, PHP, Python and Rails and in the last 7 years I focused all my work in Java, working on Linux servers using GlassFish, TomCat, Apache and MySql.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\",\"https:\/\/ve.linkedin.com\/in\/jesus-boadas\",\"https:\/\/x.com\/jboadas\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/jesus-boadas\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Vaadin Form Example - Java Code Geeks","description":"In this example I am going to show you how to make a Vaadin form. A form is a common HTML element to collect user input and send the data to a server,","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:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/","og_locale":"en_US","og_type":"article","og_title":"Vaadin Form Example - Java Code Geeks","og_description":"In this example I am going to show you how to make a Vaadin form. A form is a common HTML element to collect user input and send the data to a server,","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-03-09T13:00:45+00:00","article_modified_time":"2019-04-09T10:23:32+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","type":"image\/jpeg"}],"author":"Jesus Boadas","twitter_card":"summary_large_image","twitter_creator":"@jboadas","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Jesus Boadas","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/"},"author":{"name":"Jesus Boadas","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/506f9c2b38156c7f94bba77757206dd7"},"headline":"Vaadin Form Example","datePublished":"2016-03-09T13:00:45+00:00","dateModified":"2019-04-09T10:23:32+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/"},"wordCount":882,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","articleSection":["Vaadin"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/","name":"Vaadin Form Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","datePublished":"2016-03-09T13:00:45+00:00","dateModified":"2019-04-09T10:23:32+00:00","description":"In this example I am going to show you how to make a Vaadin form. A form is a common HTML element to collect user input and send the data to a server,","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-form-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/"},{"@type":"ListItem","position":4,"name":"Vaadin","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/vaadin\/"},{"@type":"ListItem","position":5,"name":"Vaadin Form Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/506f9c2b38156c7f94bba77757206dd7","name":"Jesus Boadas","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Jesus-Boadas_avatar_1476120926-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Jesus-Boadas_avatar_1476120926-96x96.jpg","caption":"Jesus Boadas"},"description":"I'm a self taught programmer, I began programming back in 1991 using an IBM A10 mainframe with Pascal an Assembler IBM 360\/70 emulator and Turbo C on a X86 PC, since that I work for the banking industry with emerging technologies like Fox Pro, Visual Fox Pro, Visual Basic, Visual C++, Borland C++, lately I moved out to the Airline industry, leading designing and programming in-house web applications with Flex, Actionscript, PHP, Python and Rails and in the last 7 years I focused all my work in Java, working on Linux servers using GlassFish, TomCat, Apache and MySql.","sameAs":["http:\/\/www.javacodegeeks.com\/","https:\/\/ve.linkedin.com\/in\/jesus-boadas","https:\/\/x.com\/jboadas"],"url":"https:\/\/examples.javacodegeeks.com\/author\/jesus-boadas\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/34622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=34622"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/34622\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/33079"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=34622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=34622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=34622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}