• 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

FileForm

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
 
reply
    Bookmark Topic Watch Topic
  • New Topic