开发者

How to get a tomcat project path from different project in same tomcat by using java

I am using this code to read a file in a tomcat project, called Project1 and now I want to get this path in different tomcat project, called Project2, using java.

getServlet().getServletConfig().getServletContext()
           .getResourceAsStream("pdf/invoice.jasper");

How c开发者_JAVA技巧an I do this?


  • mark the context as crossContext=true in META-INF/context.xml
  • use getServletContext().getContext("/otherApp") to get an instance to the other app's `SetvletContext
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜