1

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 can I do this?

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
tony
  • 11
  • 1

1 Answers1

4
  • 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
Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140