Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. @RequestMapping(value = "/modify/{id}")
  2. public String modifyRecipe(@PathVariable int id, Model model) {
  3. Recipe recipe = recipeService.findRecipe(id);
  4. model.addAttribute("recipe", recipe);
  5.  
  6. return "recipes/modify";
  7. }
  8.  
  9. @RequestMapping(value = "modify", method = RequestMethod.POST)
  10. public String updateRecipe(@Valid Recipe recip, Model model) {
  11. logger.info("From JSP [" + recipe + "]");
  12.  
  13. if (result.hasErrors()) {
  14. return "recipes/modify";
  15. }
  16. recipeServices.updateRecipe(recipe);
  17. return "redirect:/recipe/" + recipe.getId();
  18. }
  19.  
  20. <body>
  21. <s:url value="/recipe/modify" var="recipe_modify" />
  22. <h2>
  23. Modify
  24. <c:out value="${fn:toUpperCase(recipe.name)}" />
  25. </h2>
  26. <sf:form modelAttribute="recipe" method="POST"
  27. action="${recipe_modify}">
  28. <fieldset>
  29. <table>
  30. <tr>
  31. <th><sf:label path="name">Name of Recipe</sf:label></th>
  32. </tr>
  33. <tr>
  34. <td><sf:input path="name" size="30" /> <br /> <sf:errors
  35. path="name" cssClass="error"></sf:errors><br /></td>
  36. </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement