Hello,
I am new to Spring and are having some odd issues. For some reason I am unable to reach onSubmit method in my controller.
Here is my bean definition.
Here is my class to save some space I have omitted imports.Code:<bean name="/login.html" class="com.blah.my.webapp.LoginController"> <property name="formView" value="/WEB-INF/jsp/login"/> <!--set up to go back to the form for now. Will change later--> <property name="successView" value="/WEB-INF/jsp/login"/> </bean>
Beats me what I am doing wrong here. Your help is appreciated.Code:public class LoginController extends SimpleFormController { private final Log log = LogFactory.getLog(LoginController.class); public LoginController(){ setCommandClass(SecurityUser.class); setCommandName("loginUser"); } public ModelAndView onSubmit( HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { System.out.println("reached onSubmit..............................."); SecurityUser loginUser=(SecurityUser)command; List<SecurityUser> userList=new ArrayList<SecurityUser>() ; userList=new UserService().listAllUsers(); ModelAndView mov = new ModelAndView(getFormView(),"loginUser",loginUser); if (!userList.isEmpty()){ mov.setViewName(getSuccessView()); } mov.setViewName(getFormView()); return mov; } public ModelAndView processFormSubmission( HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { Map model = new HashMap(); model.put(getCommandName(), command); System.out.println("reached processFormSubmission..............................."); return super.processFormSubmission(request, response, command, null); } }


Reply With Quote