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
inMETA-INF/context.xml
- use
getServletContext().getContext("/otherApp")
to get an instance to the other app's `SetvletContext
精彩评论