This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynaforms, Validator and File Upload

 
Ryan Tyer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to setup dynaforms with validation for a simple file upload in Struts? If so, how?

Thanks in advance.
 
David Hibbs
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes and no. The main key is to use DynaValidatorForm rather than a simple DynaForm. DynaForm will not invoke the Validator framework while DynaValidatorForm will. You may then configure validation as with any other form.
 
Ryan Tyer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I understand the usage of DynaValidatorForm, but what do I have as my field? Typically on file upload you use a FormFile object. I'm not sure I know how to do validation on that (ie, file extension = .csv).
 
David Hibbs
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guess I misunderstood the question.
Anyway, I don't know... I haven't used the upload piece specifically.

You could write a validator class Facade for the FormFile validation, though.
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ryan

U cant validate the for formfile object (uplodaed file) using strust validation techniques.U should go for actionform and then u can do the valkidation by using ur java techniques

Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic