{"id":1731,"date":"2016-09-22T11:37:55","date_gmt":"2016-09-22T11:37:55","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1731"},"modified":"2016-12-29T05:12:11","modified_gmt":"2016-12-29T05:12:11","slug":"data-binding","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/data-binding\/","title":{"rendered":"Binding Form elements with Bean Values"},"content":{"rendered":"<p><strong>add_person.jsp<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;body&gt;\r\n  &lt;form name=&quot;frmTest&quot; id=&quot;frmTest&quot; method=&quot;post&quot; action=&quot;\/Test2\/Control1\/displayPerson&quot;&gt;\r\n    &lt;input type=&quot;text&quot; name=&quot;Name&quot; \/&gt;I Agree\r\n\t&lt;select name=&quot;Location&quot;&gt;\r\n  \t  &lt;option value=&quot;Teynampet&quot;&gt;Teynampet&lt;\/option&gt;\r\n\t  &lt;option value=&quot;TNagar&quot;&gt;TNagar&lt;\/option&gt;\r\n\t  &lt;option value=&quot;Adyar&quot;&gt;Adyar&lt;\/option&gt;\r\n\t&lt;\/select&gt;\r\n    &lt;input type=&quot;checkbox&quot; name=&quot;cboAgree&quot; value=&quot;I Agree&quot;\/&gt;I Agree\t\t\r\n    &lt;input type=&quot;submit&quot; name=&quot;btnSubmit&quot; value=&quot;Submit&quot;\/&gt;\t\t\r\n  &lt;\/form&gt;\r\n&lt;\/body&gt;\r\n<\/pre>\n<p><strong>Person.java<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic class Person \r\n{\r\n\tprivate String Name;\r\n\tprivate String Location;\t\r\n\t\r\n\tpublic String getName() {\r\n\t\treturn Name;\r\n\t}\r\n\tpublic void setName(String name) {\r\n\t\tName = name;\r\n\t}\r\n\tpublic String getLocation() {\r\n\t\treturn Location;\r\n\t}\r\n\tpublic void setLocation(String location) {\r\n\t\tLocation = location;\r\n\t}\r\n\r\n        @Override\r\n\tpublic String toString() \r\n        {\r\n\t  return &quot;Person &#x5B;Name=&quot; + Name + &quot;, Location=&quot; + Location + &quot;]&quot;;\r\n\t}\r\n}\r\n<\/pre>\n<p><strong>TestController .java<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n@Controller\r\n@RequestMapping(&quot;\/Control1&quot;)\r\npublic class TestController \r\n{\r\n\t@RequestMapping(value=&quot;\/displayPerson&quot;, method=RequestMethod.POST)\r\n\tpublic String TestMe4(@ModelAttribute Person person)\r\n\t{\r\n\t\tSystem.out.println(person); \r\n\t\treturn &quot;add_person&quot;;\r\n\t}\r\n}\r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<pre>\r\nPerson [Name=Mac, Location=TNagar]\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>add_person.jsp &lt;body&gt; &lt;form name=&quot;frmTest&quot; id=&quot;frmTest&quot; method=&quot;post&quot; action=&quot;\/Test2\/Control1\/displayPerson&quot;&gt; &lt;input type=&quot;text&quot; name=&quot;Name&quot; \/&gt;I Agree &lt;select name=&quot;Location&quot;&gt; &lt;option value=&quot;Teynampet&quot;&gt;Teynampet&lt;\/option&gt; &lt;option value=&quot;TNagar&quot;&gt;TNagar&lt;\/option&gt; &lt;option value=&quot;Adyar&quot;&gt;Adyar&lt;\/option&gt; &lt;\/select&gt; &lt;input type=&quot;checkbox&quot; name=&quot;cboAgree&quot; value=&quot;I Agree&quot;\/&gt;I Agree &lt;input type=&quot;submit&quot; name=&quot;btnSubmit&quot; value=&quot;Submit&quot;\/&gt; &lt;\/form&gt; &lt;\/body&gt; Person.java public class Person { private String Name; private String Location; public String getName() { return Name; } public void setName(String name)&hellip; <a href=\"https:\/\/codethataint.com\/blog\/data-binding\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[202],"tags":[],"class_list":["post-1731","post","type-post","status-publish","format-standard","hentry","category-data-binding"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=1731"}],"version-history":[{"count":3,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1731\/revisions"}],"predecessor-version":[{"id":1984,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1731\/revisions\/1984"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}