title: Java Spring MVC get/post in same JSP
body: <p>this is from my controller..</p>
  
  <pre><code>    @RequestMapping(value = "/add", method = RequestMethod.GET)
  public String add(Model model) {
      return "add";
  }
  
  @RequestMapping(value = "/add", method = RequestMethod.POST)
  public String added(@RequestParam("name") String name, Model model) {
      City city = new City();
      city.setCity(name);
      service.addCity(city);
      return "add";
  }
  </code></pre>
  
  <p>this is my JSP view..this is only for adding at the moment...this is add.jsp..so it posts back to itself</p>
  
  <pre><code>    &lt;form method="post" action="/spring/krams/edit/add"&gt;
  Linna nimi
  &lt;input type="text" name="name"&gt;
  &lt;input type="submit" value="Test" name="submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>i would like the JSP file change , so that when i post it to this file, then it says..."CITY ADDED" . is that possible?</p>
  
  <p>WHAT ABOUT UPDATING A CITY??</p>
  
  <pre><code>    @RequestMapping(value = "/update", method = RequestMethod.POST)
  public String updated(@RequestParam("city") int city_id,
                        @RequestParam("text") String name,
                        Model model) {
      service.updateCity(name, city_id);
      return "update";
  }
  </code></pre>
  
  <p>Here is no object?</p>