This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a simple page in which the User accepts an input file and does some bussiness logic. I wanted to have validation in the ActionForm as i want to check for file format, size etc.
I have added the code to the validate method in ActionForm and if there are any errors, I create ActionMessage Object and add them to ActionErrors.
I have <html:errors/> in my JSP so that if there are any problems, errors are displayed and the page does not gets submitted
For some reason, it is not working.
I have validate attribute set to true in the struts-config file. Actually, i can see the code going through the validate method, but then it displays a blank page ( from the URL i see in the page, it seems to be pointing to the struts action link ). If i have a valid file, everything works fine
You have not done anything wrong. If the validation ends in success, no issues. If not, the controller will will forward it to JSP. Have you given else where the forward path JSP when the validation fails?
If not, since the controller does not find any matching forward, it will display a blank page.