Guest User

Untitled

a guest
Aug 16th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. Spring MVC Annotated Controller Interface
  2. @Controller
  3. @RequestMapping("/services/goal/")
  4. public interface GoalService {
  5.  
  6. @RequestMapping("options/")
  7. @ResponseBody
  8. Map<String, Long> getGoals();
  9.  
  10. @RequestMapping(value = "{id}/", method = RequestMethod.DELETE)
  11. @ResponseBody
  12. void removeGoal(@PathVariable String id);
  13.  
  14. }
  15.  
  16. @Component
  17. public class GoalServiceImpl implements GoalService {
  18.  
  19. /* init code */
  20.  
  21. public Map<String, Long> getGoals() {
  22. /* method code */
  23. return map;
  24. }
  25.  
  26. public void removeGoal(String id) {
  27. Goal goal = goalDao.findByPrimaryKey(Long.parseLong(id));
  28. goalDao.remove(goal);
  29. }
  30.  
  31. }
  32.  
  33. ExceptionHandlerExceptionResolver - Resolving exception from handler [public void
  34. todo.webapp.controllers.services.GoalServiceImpl.removeGoal(java.lang.String)]:
  35. org.springframework.web.bind.MissingServletRequestParameterException: Required
  36. String parameter 'id' is not present
Add Comment
Please, Sign In to add comment