I am using simple form controller. i have a simple login form and i want to validate username and password from database. there are two approaches.
1. call database dao in controller class validate
2. call database dao in validator
1. call database dao in controller class: how to get access to errors object in controller to validate the form
2. call database dao in validator : how to get database connection in validator.
SpringJdbcDaoImpl dao=(SpringJdbcDaoImpl) getApplicationContext().getBean("jdbcConnection");
--->getApplicationContext() method is not working in validator class.