Results 1 to 3 of 3

Thread: Spring MVC-Validation

  1. #1
    Join Date
    Oct 2012
    Posts
    3

    Question Spring MVC-Validation

    Hi ,

    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.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Oct 2012
    Posts
    3

    Thumbs up

    Thanks Martein, I am new to Spring MVC , i have read spring reference but its not that clear and simple

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •