5 Replies Latest reply on Jan 9, 2008 10:18 AM by pmuir

    trying to display a .doc file

    mikeeprice

      Trying to display a an MS Word .doc file with

      <s:link view="/CamdenPlanVSN-1.2-1-2-08.doc" styleClass="footerLink">
      <h:outputText value="Camden Emergency Plan"/>
      </s:link>

      but get

      description The requested resource (/cwe/CamdenPlanVSN-1.2-1-2-08.seam) is not available.

      I can not find documentation telling how to display .doc files and other file types under Seam. For some reason it changes .doc to .seam on the file name.

      I would also like to bring it up in a new window such as target="_blank".

      Any suggestions, Thanks

        • 1. Re: trying to display a .doc file
          jazir1979

          I serve files out of the DB using a custom FileServlet, with code similar to the following:

          response.setHeader("Content-Disposition", "attachment; filename=" + file.getFilename());
          response.setContentType(file.getContentType());
          response.setContentLength(file.getData().length);
          response.getOutputStream().write(file.getData());
          response.flushBuffer();
          


          It sounds like you want to load yours from the filesystem, but it should be similar. The "Content-Disposition" header with value "attachment" makes it open the file in a new window.


          "mikeeprice" wrote:
          Trying to display a an MS Word .doc file with

          <s:link view="/CamdenPlanVSN-1.2-1-2-08.doc" styleClass="footerLink">
          <h:outputText value="Camden Emergency Plan"/>
          </s:link>

          but get

          description The requested resource (/cwe/CamdenPlanVSN-1.2-1-2-08.seam) is not available.

          I can not find documentation telling how to display .doc files and other file types under Seam. For some reason it changes .doc to .seam on the file name.

          I would also like to bring it up in a new window such as target="_blank".

          Any suggestions, Thanks


          • 2. Re: trying to display a .doc file
            mikeeprice

            What I am wondering is why doesn't

            mydoc

            where mydoc.doc is an MSword file, work in my Seam application?

            it says that mydoc.seam is not available. I don't understand Seam well enough to know why it is replacing .doc with .seam.

            What I did to make this work is create a separate war file from my Seam application that had an html page with <a ref statements in it and Then I would link to that page from my Seam application pages. I think there is something I don't understand about Seam because I don't think I should have to do this.

            I think I should be able to do <s:link view="mydoc.doc" value="mydoc"/> and a window with the MS Word file should pop up just like it normally does in a non Seam application.

            • 3. Re: trying to display a .doc file
              mikeeprice

              I forgot to disable html in previous post

              mydoc should be mydoc

              • 4. Re: trying to display a .doc file
                mikeeprice

                Well I guess I don't undertstand how to display html in a post.

                maybe "<"a href="mydoc.doc">mydoc" will make it work

                • 5. Re: trying to display a .doc file
                  pmuir

                  Use

                  <a href="mydoc.doc" />
                  
                  not s:link