File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes FileForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "FileForm" Watch "FileForm" New topic
Author

FileForm

John Lark
Ranch Hand

Joined: Feb 08, 2010
Posts: 72
Hey All,

I am currently working on a project in which I must import the Contents of a file from a users computer, then save the contents to the database. My Original attempt was to get the file location using <html:file> as a string and loading the acctual however, this failed miserably so I have resorted to using FileForm. My latest attempt is to pull it from the form, use a getInputStream(). Convert the Input Stream into a Document(its XML) like so Document DocYadda= db.parse(InputStreamYadda). I then convert it to a string and input it into the database. The String value displayed is [#document: null]!? Even when I use JOption to take a peak before it gets put into the database, I get this same result. I know its getting the Content because I can see it using Firefox's Data Tamper, somthings happining between the form and the database though that I just cant figure out? Any ideas on what this could possibly be? Is there somthing special that must be done in order to convert the Code to a stream.


InputStream InputSTreamYadda= BeanYadda.getFileForm.getInputStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document DocumentYadda= db.parse(InputSTreamYadda);
YaddaBean.setFileForm(DocumentYadda);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FileForm