Not able to update the record in the database using edit controller
I need to edit description from particular code
getting error
org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'code' is not present
Select all
Open in new window
@RequestMapping(value = "/editRights")
public String editrights(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam("code") String code,
@RequestParam("Description") String Strname,
HttpSession session,
Model model) {
List<Rights> groups = new ArrayList<Rigsht>();
Rights right = null;
EntityManager em = ToplinkUtil.getViewableEntityManager( request, "owner" );
try {
Right1 = Rights.findAll(em);
right= em.find(Right.class, code);
em.refresh(code);
model.addAttribute("code", code);
return "user/mainGroups";
} catch (Exception e) {
return "failure";
} finally {
em.close();
}
}
Select all
Open in new window
find all method
public static List<Rights> findAll( EntityManager em ) {
List<WebdUserGroup> results = em.createQuery( "select distinct wug from Rights wug order by wug.code" ).getResultList();
return results;
}
Select all
Open in new window
You must be missing "code" in the request. Check for spelling/case.