title: Spring mvc can not get the form param
body: <p>Below is my code, and always get null for query method, i do not know why this happen. I can get the form param by other ways, such as @RequestParam etc. Do i need to set configuration for the Phone Class in the XML file? if so, how can i configure Phone Class in XML? My XML is recharge-servlet.xml.</p>
  
  <p>Below is the Controller:</p>
  
  <pre><code>package com.nu.template.recharge;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.servlet.ModelAndView;
  
  
  @Controller
  @RequestMapping("/mobile")
  
  public class XJMobile {
  
      @RequestMapping(value = "/index", method = RequestMethod.GET)
      public ModelAndView getIndexPage() {
          ModelAndView mav = new ModelAndView("recharge");
          return mav;
      }
  
  
      @RequestMapping(value = "/query", method = RequestMethod.POST)
      public String query(Phone phone) {
          System.out.println(phone.getNumber());
  
          return "helloworld";
      }   
  
  }
  </code></pre>
  
  <p>Form:</p>
  
  <pre><code>&lt;form action="query" method="POST" name="phone_form"&gt;
      &lt;section&gt;
          &lt;label&gt;phone:&lt;/label&gt;
          &lt;input type="text" name="phone_number" /&gt;
      &lt;/section&gt;
  
      &lt;input type="submit" value="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Phone Class:</p>
  
  <pre><code>package com.nu.template.recharge;
  
  public class Phone {
      private String phone_number;
  
      public String getNumber() {
          return this.phone_number;
      }
  
      public void setNumber(String phone_number) {
          this.phone_number = phone_number;
      }
  }
  </code></pre>
  
  <p>recharge-servlet.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xsi:schemaLocation="http://www.springframework.org/schema/beans      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"&gt;
  
  &lt;mvc:annotation-driven /&gt;
  
  &lt;context:component-scan base-package="com.nu.template.recharge"/&gt;
  
  &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
     &lt;property name="prefix" value="/WEB-INF/view/"/&gt;
     &lt;property name="suffix" value=".jsp"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>