How does JVM uniquely identify JSP’s with same name in different folder across different applications?
To be more clear Say two applications (war’s) are deployed on server A1 and A2. Now A1 has Random.jsp in folder F11 and F12 (2 jsp with identical names but different code), similarly A2 has Random.jsp in F21 and F22.
When the code is deployed and jsp’s are translated into Servlets I believe the Servlet name would be same as well for all 4 JSP’s. So how does JVM identify them uniquely for respective requests?
Had it been limited to a single application, I would have assumed JVM would use folder names as packages during servlet translation but does it work across applications.
Also please enlighten, whether JVM takes care of this distinction by declaring different packages for the generated servlet or using some internal mapping structures of different classes (this second option sounds quite weird)
That is implementation dependent. The way TOMCAT does it, is using a work directory with separate folders for A1.war and A2.war. That way, despite “Random.jsp” generating the same servlet name same for both WARs, they’re placed in different folders so there’s no possible confusion.
Example: