Unable to delete an entry-Springs MVC Hibernate
I am trying to delete an entry through spring mvc but I am unable to do
it.I am getting 404 error stating requested resource not found.
My controller code is
@RequestMapping("/delete/{user_id}")
public ModelAndView deleteUser(@PathVariable("user_id")Integer user_id){
userService.removeUser(user_id);
return new ModelAndView("redirect:/userList.html");
}
and that its going to the UserService and from there its going to
UserServiceImpl and from there to Dao whose code is
public void removeUser(Integer user_id){
User user = (User) sessionfactory.getCurrentSession().load(
User.class, user_id);
if (null != user) {
sessionfactory.getCurrentSession().delete(user);
System.out.println("Successfully deleted");
}
My url for the code generated is right i guess its /delete/4.So I am
unable to get the problem.
No comments:
Post a Comment