wood burning stoves*
The moose likes Struts and the fly likes How to convert File object to Formfile object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to convert File object to Formfile object" Watch "How to convert File object to Formfile object" New topic
Author

How to convert File object to Formfile object

venkatesh warlu
Ranch Hand

Joined: Mar 11, 2008
Posts: 33
Hi all,

I am having a file object. I need to convert it into FormFile object. It shows classcastexception when try to type cast it. Please help.

File reqFile = new File("file.txt");
myForm.setReqFile(reqFile);

The setReqFile is a private Formfile variable in my form like "private FormFile reqFile;"

Thanks in advance!!

Regards
Venkat
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to convert File object to Formfile object