• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validation problem during FileUpload

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

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??

Thanks
-Aj
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ajju Chawla
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...

If I understood u wrong pls tell me.

-Aj
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using the validator framework you can enable client side validation. I have never used client side validation, so I don't know the details. This uses Javascript and displays a popup message if a validation rule fails. If you are not using the framework or you have complex validation rules, you could implement the same type of validation using custom Javascript.

- Brent
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic