Discussions

Web tier: servlets, JSP, Web frameworks: not able to open,view .doc,.xls,.pdf,.txt,.ppt files using JSP

  1. Hi all, I have the above different file types in my JSP.If I open the word,excel,ppt or txt file, I am unable to view the files.

    I attach a file and upload it in server and then store as a BLOB in the database. I retrieve the file and try displaying using the JSP. It tries to open the file using respective software I mean,MS Excel,MS word,MS PP,txt.exe etc, but then it says the file is not in the respective format.opens up with a dialog error box. I use this tag in my JSP file. I guess this will help in opening up the file. Do I need anything else like MIMI TYPE?
                                                            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> My flow is JSP->Form Handler or Taglib-> business Delegate -> EJB -> DAO . Please help me ASAP if possible.
                                                                Matt
  2. I usually leave such files on the drive rather then in the db, and provide a link to the file and let the container/server handle the actual transfer. Much easier.
    If I understand you correctly, you're going to need some sort of file serving servlet to do the same thing. You can't do it straight from the jsp file itself.