3 Replies Latest reply: Apr 3, 2008 7:20 AM by 807591 RSS

    how to map file from .ear file?

      Hi experts,

      I have deployed an application on websphere 6.0 using application.ear.
      I want a file from that application.ear to give path in one of the hyperlink in some .jsp file.
      The application.ear file has webPro.war and other files in it.
      and the file that I want is in webPro.war/Prod/policy.pdf

      on the click of the hyperlink this .pdf should be referenced for view/download.

      how can I map /application.ear/webPro.war/Prod/policy.pdf in my jsp file?

      thanks in advance...
        • 1. Re: how to map file from .ear file?
          I'm no guri, but I don't think you can reference a jar'ed resource from outside the jar.

          I think you'll need to copy the pdf to a web-acessible folder under your application's domain directory.

          I suppose you could add that "copy" step somewhere in your web-app's startup... that way you can just ship your war, and every time the web-app is loaded it'll create that file... you could even put an exists check in there to save re-copying a perfectly good file.
          • 2. Re: how to map file from .ear file?

            You can use href option of html in your jsp by specifying the path of pdf in <a .... /a> tag.

            Well after deploying your ear application in websphere, you can use the context path of your application in above mentioned path.

            Baseet Ahmed
            • 3. Re: how to map file from .ear file?
              thanks for the quick reply.

              it is for sure that <a /a> has to be used. but the problem is file is in my /web-inf folder, which can't be refereced directly...is there any alternate other than writing my own servlet to copy file...