Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(value = "/modify/{id}")
- public String modifyRecipe(@PathVariable int id, Model model) {
- Recipe recipe = recipeService.findRecipe(id);
- model.addAttribute("recipe", recipe);
- return "recipes/modify";
- }
- @RequestMapping(value = "modify", method = RequestMethod.POST)
- public String updateRecipe(@Valid Recipe recip, Model model) {
- logger.info("From JSP [" + recipe + "]");
- if (result.hasErrors()) {
- return "recipes/modify";
- }
- recipeServices.updateRecipe(recipe);
- return "redirect:/recipe/" + recipe.getId();
- }
- <body>
- <s:url value="/recipe/modify" var="recipe_modify" />
- <h2>
- Modify
- <c:out value="${fn:toUpperCase(recipe.name)}" />
- </h2>
- <sf:form modelAttribute="recipe" method="POST"
- action="${recipe_modify}">
- <fieldset>
- <table>
- <tr>
- <th><sf:label path="name">Name of Recipe</sf:label></th>
- </tr>
- <tr>
- <td><sf:input path="name" size="30" /> <br /> <sf:errors
- path="name" cssClass="error"></sf:errors><br /></td>
- </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement