Having an issue with a controller not returning the correct view. Instead, it just goes back to the original view.
Here is the handleRequest:
Everything here works correctly, no issues.Code:public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { super.handleRequest(request, response); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //CREATING MAP AND POPULATING IT ModelAndView mav = new ModelAndView("login/login_test"); mav.addObject("model", myMap); return mav; }
Here is the onSubmit method:
Everything works correctly, user gets set and permissions are set. The problem is that it does not move to the Success View or the incorrect view, but instead always stays on the same view, no matter the if the password is correct or not.Code:protected ModelAndView onSubmit(Object command) throws ServletException { String name = ((Login) command).getName(); String password = ((Login) command).getPassword(); // VARIOUS OPERATIONS, GETTING PERM NUMBER // checking the username and password and setting the permission if (perm != 0) { // VARIOUS OPERATIONS, SETTING USER PERMISSION AND NAME if (perm == 6) return new ModelAndView(getSuccessView(),myModel); else if (perm == 5) return new ModelAndView("scriptmenu", "model", myModel); else return new ModelAndView("hello", "model", myModel); } else { return new ModelAndView("incorrect", "model", myModel); } }
Here is the bean:
Any help is greatly appreciated, thanks!Code:<bean name="/logintest.htm" class="storeapp.web.LoginTestController" scope="prototype"> <property name="sessionForm" value="true"/> <property name="commandName" value="login"/> <property name="commandClass" value="storeapp.service.Login"/> <property name="formView" value="login"/> <property name="successView" value="tsemenu.htm"/> <property name="userManager" ref="userManager"/> <property name="scriptManager" ref="scriptManager"/> </bean>


Reply With Quote
