title: Getting selected option value from controller in Spring MVC
body: <p><a href="https://i.stack.imgur.com/ittXI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ittXI.jpg" alt="enter image description here"></a></p>
  
  <p>I'm making a Spring MVC project, and I have this form in my .jsp</p>
  
  <p><strong>JSP</strong></p>
  
  <pre><code> &lt;form:form action="/admin/assign/add" modelAttribute="cafeTable"&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;form:label path="tableNumber"&gt;
                      &lt;spring:message text="Table's Number"/&gt;
                  &lt;/form:label&gt;
              &lt;/td&gt;
              &lt;td&gt;
              &lt;form:select path="tableNumber" action = "select"&gt;
                  &lt;form:options items="${tableNumbers}"&gt;&lt;/form:options&gt;
              &lt;/form:select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;form:label path="${user.fullName}"&gt;
                      &lt;spring:message text="Waiter's name"/&gt;
                  &lt;/form:label&gt;
              &lt;/td&gt;
              &lt;td&gt;
              &lt;form:select path="${user.fullName}" action = "select"&gt;
                  &lt;c:forEach items="${listUser}" var="user"&gt;
                      &lt;option value="${user.fullName}"&gt;${user.fullName}&lt;/option&gt;
                  &lt;/c:forEach&gt;
              &lt;/form:select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;br&gt;
      &lt;input type="submit" name="assign"
             value="&lt;spring:message text="Assign"/&gt;"/&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>So I have <code>User</code> and <code>CafeTable</code> models, but my model attribute is <code>CafeTable</code>.</p>
  
  <p>With the submit button I need to get both selected values in my controller:</p>
  
  <pre><code>    @RequestMapping(value = "/admin/assign/add", params = "assign", method = RequestMethod.POST)
  public String assign(@ModelAttribute("cafeTable") CafeTable cafeTable) {
  
      //set cafeTable's UserID field matching selected fullName value
  
      tableService.addTable(cafeTable);
      return "admin";
  }
  </code></pre>
  
  <p>How can I do this?</p>