Announcement Announcement Module
No announcement yet.
Validator and AbstractController Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validator and AbstractController

    Hi all,
    I want to know how to use validator with AbstractContoller. The requirement is:
    There is a list of persons name, with corresponding edit and delete links. Like

    HTML Code:
    Name   Edit  Delete
    name1 .....   .....
    name2 .....   .....
    .          .        .
    .          .        .
    When I click on Delete link, it will call a controller that extends AbstractController. Now when I try to delete Person object in the database, as excepted it will throw a DataIntegrityViolationException due to Foreign key constraint.
    In my application there are say some 3 objects O1, O2 and O3, and all have the instance of Person object. I want to check whether these 3 objects are null in the validator before hitting the controller. If these 3 objects are null proceed to the controller for deleteion of Person persistent object via DAO layer. On successful deletion the same list page(shown above) should be displayed, else if any of these objects are not null a page should be displayed with the message cannot be deleted due to some constraint.

    I don't know what is the best way of dealing with this?
    Please can anyone help me out.
    Thanks in advance.