title: How would I parse a string in @RequestBody?
body: <p>Here is my HTML Page :</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;Sports&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;center&gt;
          &lt;h1&gt;Configuring Database for MSell Application&lt;/h1&gt;
          &lt;form method="post" action="http://localhost:8080/MSellApp/msellapp/DBConfig/changedb" enctype="text/plain"&gt;
              &lt;table border="0"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Database to be Used&lt;/td&gt;
                      &lt;td&gt;&lt;select name="selectDB"&gt;
                              &lt;option value=0&gt;Sports and Outdoor&lt;/option&gt;
                              &lt;option value=1&gt;Fashion&lt;/option&gt;
                          &lt;/select&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td colspan="2"&gt;&lt;input type="submit" value="submit"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/form&gt;
      &lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is my spring rest service.</p>
  
  <pre><code>@RequestMapping("/DBConfig")
  @RestController
  public class DBConfigController {
  
      final static Logger logger = Logger.getLogger(DBConfigController.class);
  
  
      @Autowired
      DBConfig dbc;
  
      @RequestMapping(value="/changedb",method = RequestMethod.POST,consumes="text/plain",produces="text/plain")
      String changeDB(@RequestBody String db){
          logger.info("DB Selected :- " +db);
          System.out.println(db);
  
              if(db.equals("selectDB=0"))
                  dbc.sessionFac="sports";
              else
                  dbc.sessionFac="fashion";
  
  
          return dbc.sessionFac;
  
  
      }
  }
  </code></pre>
  
  <p>That String comparison is always getting failed.I am using spring rest API. I'm just finding it too difficult to crack why the string comparison always fails even though the print statement prints the same "selectDB=0". Can Somebody tell me why ?</p>