开发者

Problem with paths when deploying my web app

I am having big issues deploying my web app to Tomcat 5.5

My server side code must access files found under a directory parallel to my WEB-INF folder.

When on developement mode, a simple relative pa开发者_如何学运维th (mydirectory/myfile) works prefectly.

When deployed, the sayed path does not work anymore I dont know why.

Is there a way to make it work without using any absolute path?

Here is my War directory

  • War
    • WEB-INF
    • Mydirectory
      • Myfile
    • Mywebbapp.html


Obtain your root folder relative to contextRoot by calling javax.servlet.ServletContext.getRealPath("/"). Then proceed with this path...


Using relative path will work, but you need to be aware of what the containers considers to be the root directory and base your relative path from there. If you specify your directory structure better, I can help you with the path - Basically try using the .. operator to move from the container root to the needed directory

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜