title: JSP form tag action attribute URI Spring MVC
body: <p>I got controller like this</p>
  
  <pre><code>   @Controller
      @RequestMapping("/pizza")
      public class PizzaController {
  
      @RequestMapping(value = "/", method = RequestMethod.GET)
      public String viewPizzas(Model model) {
          model.addAttribute("pizzas",
                  pizzaService.getAllPizzas());
          return "pizzas";
      }
       @RequestMapping(value = "/create", method = RequestMethod.GET)
          public String create() {
              return "newpizza";
          }
  
          @RequestMapping(value = "/addnew", method = RequestMethod.POST)
          public String addNewPizza(@ModelAttribute Pizza newPizza) {
              pizzaService.addPizza(newPizza);
              return "redirect:";
          }
  
          }
  
          @RequestMapping(value = "/edit", method = RequestMethod.GET)
          public String edit(@RequestParam("pizzaid") Long id, 
                  Model model) {
              if (id&lt;=0) throw new IllegalArgumentException("ID&lt;0");
              Pizza pizza = pizzaService.getPizzaById(id);
              if (pizza == null) 
                  throw new NotFoundPizzaException("Pizza id" + id + " not found" );
              model.addAttribute("pizza", pizza);
              return "newpizza";
          }
      }
  </code></pre>
  
  <p>and JSP's:pizzas.jsp</p>
  
  <pre><code>    &lt;body&gt;
          &lt;table border="1"&gt;
             ......................
                          &lt;form method="get" action="edit" &gt;
                              &lt;input type="hidden" name="pizzaid" value="${pizza.id}" /&gt;
                              &lt;input type="submit" value="Edit" /&gt;
                          &lt;/form&gt;        
  
          &lt;/table&gt;
          &lt;a href="create"&gt; Create new pizza &lt;/a&gt; &lt;br/&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p>and newpizza.jsp</p>
  
  <pre><code>&lt;body&gt;
          &lt;form action="addnew" method="post"&gt;
                     &lt;input type="hidden" name="id" value="${pizza.id}"/&gt;
              Name : &lt;input type="text" name="name" value="${pizza.name}"/&gt;&lt;/br&gt;
              Type : &lt;input type="text" name="type" value="${pizza.type}"/&gt;&lt;/br&gt;
              Price : &lt;input type="text" name="price" value="${pizza.price}"/&gt;&lt;/br&gt;
              &lt;input type="submit" value="Create"/&gt;&lt;/br&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p>And this works fine, untill I try to change URI's in my Controller, for example like this:</p>
  
  <pre><code>@RequestMapping(value = "/addnew/add", method = RequestMethod.POST)
  @RequestMapping(value = "/edit/add", method = RequestMethod.GET)
  </code></pre>
  
  <p>and in form tag:</p>
  
  <pre><code>&lt;form action="addnew/add" method="post"&gt;
  &lt;form action="edit/add" method="get"&gt;
  </code></pre>
  
  <p>I get <code>HTTP Status 404</code>. I have a question: how should I use <code>action</code> attribute, to get the opportunity to request mapings like this <code>@RequestMapping(value = "/edit/add"</code>...</p>