Hi everyone, Perhaps a simple question. Say for Example I have a createStudent method as follows in my bean:
Now when I call this method in my action(struts) everything works fine but what is bothering me is that I don't want the error from the EJB layer to come up one by one. So, on the UI when I forget entering both name and age. I get error saying "name is required" and when I fill that, I get "age is required". Is there a good way I can add up the messages and send it back to the client/action calling it. Should I be throwing Exception or something else? Is there a way to include lists in exceptions?
Note- I understand I can do validation on client side also for required fields. But this is a simple example; there could be business logic validations on EJB and I want to add them up and send all at once.
[ November 21, 2008: Message edited by: Reza Rahman ]
I've worked with Hibernate before but never used Hibernate Validators. But offlate I'm working on EJB 3 and very soon I will be implementing JPA for my current project. I would like to know if I can use these Validators for my JPA? All I would have to do it to include the validator.jar file in my classpath? Am I right?