Reputation: 414
I have created a servlet project (MyEE) with a index.jsp.. while launching (htt..//.../MyEE), the container will loads my index.jsp
(My Understanding - the jsp parser will create a class file out of the index.jsp and place it inside org.apache.jsp package in the name index_jsp.class and then the container will load that class file )
So on launching the root url the container will load the class file org.apache.jsp.index_jsp (inside catalina folder - I am using tomcat).
Just for testing, I have created similar package in my project and a class of same name like org.apache.jsp.index_jsp (inside classes folder)...
So I am having a duplicate class,,,,,,... But while launching the root url.. the container loads the jsp class perfectly without any conflict.....?
How the container makes it possible?
(Also i tried with same class in a jar and classes folder.. it loads the class inside classes folder without any conflicts !!!! How???????)
Upvotes: 1
Views: 72
Reputation: 691625
The class loader looks for the class file in all the directories and jars that constitute its classpath. As soone as it finds it, it uses this one, without caring if another directory or jar also contains a class with the same name.
Upvotes: 1