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.
I suggest the reference guide as you seem to be missing basic understanding on DI and how Spring MVC works.
You could do both
1. BindResult == Errors so checkout how to do binding
2. Dependency Injection don't do a lookup...
Thanks Martein, I am new to Spring MVC , i have read spring reference but its not that clear and simple