开发者

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

开发者 https://www.devze.com 2023-03-23 05:34 出处:网络
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.

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

精彩评论

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