protected ModelAndView onSubmit( HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { long user_id = 0; SsUsr ssUser = (SsUsr) command; Map<String, String> requestModel = new HashMap<String, String>(); user_id = ssUserBusiness.findAndKeepUserByUNamePwd(ssUser.getSsUsername(), ssUser.getSsPassword()); if (user_id != 0 && user_id != -1) { // requestModel.put(SSConstants.USER_ID, String.valueOf(user_id)); request.getSession().setAttribute(SSConstants.USER_ID, user_id); ssUser.setUserId(String.valueOf(user_id)); /** * added code to set authentication object for SS user Remove this code after integrating the * spring security in the SS Web */ SecurityContext context = SecurityContextHolder.getContext(); Authentication authentication = getAuthenticationObjectForSSUser(ssUser); context.setAuthentication(authentication); ModelAndView view = new ModelAndView(new RedirectView(SSConstants.CONTROLLER_DASHBOARD)); return view; } else if (user_id == -1) { request.setAttribute(SSConstants.USER_WRONG_PWD, SSConstants.NO); return new ModelAndView(getSuccessView(), "ssUser", ssUser); } else { request.setAttribute(SSConstants.USER_AUTHORISATION, SSConstants.NO); return new ModelAndView(getSuccessView(), "ssUser", ssUser); } }