The BDs should know nothing about what presentation framework you are using, agreed. As point in case for the BDs I am writing if I decide to change the Web Application Framework from STRUTS to say SPRING MVC I should not have to re-write validation code to check contents of the file are valid values, I want this to be done in BD class.
I understand the idea of throwing custom exceptions from the BD to be returned to the web layer but can I explain my specific problem and maybe you can tell me if the solution still works.
I am uploading a excel file populated with data that I wish to import into my data store. Hence after I perform form validation on the file in the web layer (i.e) file is under a certain size, has a validly formed name whatever... I pass an java.io.InputStream object to the BD with has the relevant package to access the contents of the excel file. Now I want to validate that the contents of the excel file are correct (i.e) values in certain rows and columns are what I expect them to be, say only integers in column A or dates in column C. The package allows me to perform this validation.
Ideally what I would like to do validate the entire excel file and save all exceptions that may be thrown detailing row number and column ( information that I can obtain in the package or programme code ) and return that data to the user back threw the BD up the the web layer and presented to them as an ActionError might be. (i.e) The value on Row 3 column 5 must be an integer. The value on Row 4 column 3 must be an date... and so on.
Will your solution cope with this? If so, can you detail to my how it might be done.
Thanks again for the help, much appreciated.
Barry