I've a JSP page in which user enters certain inputs and uploads a file. These inputs I validate in the validate () method in the Form class. Now the problem is that in case a file of bigger size is uploaded, it takes lot of time to display a message to the user if one of the validation fails. Is there some way that I validate the inputs from the screen and if everything is ok , then only proceed with file upload??
What I would suggest is keep the file input-type disabled in ur jsp when it renders for 1st time or when validation fails. If validation is successful then redirect to the same jsp with the input type as enabled. You can do the conf settings in the struts-config.xml.
Joined: Oct 21, 2005
Hi, thanks for the reply..
So what u r saying is that during the first submit 1. submit the page without the FileForm fields(disable input-type file). 2. Validate and if there is error than set Action Error. 3. Else redirect on the same page enable input-type = file, and submit on load.
The problem would come in #3. I'll loose the selected files, and it would not be nice to display the same page to the user again...