{"id":1677,"date":"2016-09-21T09:33:16","date_gmt":"2016-09-21T09:33:16","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1677"},"modified":"2016-12-29T05:10:46","modified_gmt":"2016-12-29T05:10:46","slug":"handling-form-elements","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/handling-form-elements\/","title":{"rendered":"Choosing Controllers based on Form Inputs"},"content":{"rendered":"<p><strong>hello.java<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;%@ page language=&quot;java&quot; contentType=&quot;text\/html; charset=ISO-8859-1&quot;\r\n    pageEncoding=&quot;ISO-8859-1&quot;%&gt;\r\n&lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/html4\/loose.dtd&quot;&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=ISO-8859-1&quot;&gt;\r\n&lt;title&gt;Insert title here&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;form name=&quot;frmTest&quot; id=&quot;frmTest&quot; method=&quot;post&quot;&gt;\t\t\r\n\t&lt;select name=&quot;cboArea&quot;&gt;\r\n\t\t&lt;option value=&quot;Teynampet&quot;&gt;Teynampet&lt;\/option&gt;\r\n\t\t&lt;option value=&quot;TNagar&quot;&gt;TNagar&lt;\/option&gt;\r\n\t\t&lt;option value=&quot;Adyar&quot;&gt;Adyar&lt;\/option&gt;\r\n\t&lt;\/select&gt;\t\t\r\n\t&lt;input type=&quot;checkbox&quot; name=&quot;cboAgree&quot; value=&quot;I Agree&quot;\/&gt;I Agree\t\t\r\n\t&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&lt;\/html&gt;\r\n<\/pre>\n<p><strong>TestController.java<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.mugil.controls;\r\n\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\n\r\n@Controller\r\n@RequestMapping(&quot;\/Control1&quot;)\r\npublic class TestController \r\n{\t\r\n\t@RequestMapping(&quot;\/Control2&quot;)\t\t\r\n\tpublic String TestMe()\r\n\t{\r\n\t\treturn &quot;hello&quot;;\r\n\t}\r\n\r\n\t@RequestMapping(value=&quot;\/Control2&quot;, method=RequestMethod.POST)\r\n\tpublic String TestMe2()\r\n\t{\r\n\t\tSystem.out.println(&quot;Hi there&quot;);\r\n\t\treturn &quot;hello&quot;;\r\n\t}\r\n\r\n\t@RequestMapping(value=&quot;\/Control2&quot;, method=RequestMethod.POST, params={&quot;cboArea=TNagar&quot;, &quot;cboAgree&quot;})\r\n\tpublic String TestMe3()\r\n\t{\r\n\t\tSystem.out.println(&quot;I am in TNagar&quot;);\r\n\t\treturn &quot;hello&quot;;\r\n\t}\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>hello.java &lt;%@ page language=&quot;java&quot; contentType=&quot;text\/html; charset=ISO-8859-1&quot; pageEncoding=&quot;ISO-8859-1&quot;%&gt; &lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/html4\/loose.dtd&quot;&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=ISO-8859-1&quot;&gt; &lt;title&gt;Insert title here&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt; &lt;form name=&quot;frmTest&quot; id=&quot;frmTest&quot; method=&quot;post&quot;&gt; &lt;select name=&quot;cboArea&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; &lt;\/html&gt; TestController.java package com.mugil.controls;&hellip; <a href=\"https:\/\/codethataint.com\/blog\/handling-form-elements\/\">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":[200],"tags":[],"class_list":["post-1677","post","type-post","status-publish","format-standard","hentry","category-controllers"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1677","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=1677"}],"version-history":[{"count":4,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1677\/revisions"}],"predecessor-version":[{"id":1983,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1677\/revisions\/1983"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}