When i deploy the war file named 'myapp.war' inside the tomcat 6 webapps folder the images in jsp are loading properly whereas if i deploy it inside webapps/ROOT folder the images are not loading in jsp.
war file structure
In the jsp page the image inside the images folder are called like <img src="images/img1.png"/>
I will great if you can suggest some solution
Thanks in advance.
Tomcat doesn't serve loose files, only webapps. And webapps cannot be nested. So dropping a WAR into TOMCAT_HOME/webapps/ROOT will not work, since ROOT is itself an exploded WAR for the webapp at the root context.
An IDE is no substitute for an Intelligent Developer.
Joined: Feb 19, 2009
I have not deployed the war inside tomcat root folder i have just deployed the contents of the war inside ROOT folder
Joined: Feb 19, 2009
I have found the solution finally.
What happens is when the code is deployed inside ROOT or the war deployed inside webapp and made as ROOT application by changing the context in tomcat server.xml
in either way tomcat is considering like the complete war contents is directly inside the tomcat webapp folder .
I was already having a folder named images directly inside webapps (for some other purpose) because of this the images folder was overridden . when i removed/renamed that folder the expected images (the images called from jsp) started appearing.
Giri rangaraju wrote:I have not deployed the war inside tomcat root folder i have just deployed the contents of the war inside ROOT folder
I didn't say anything about a "Tomcat root folder". I said that TOMCAT_HOME/webapps/ROOT" is a WAR folder and that you cannot embed WARs within other WARS.
Setting up Tomcat so that the TOMCAT_HOME/webapps folder itself is presented as an exploded WAR is something that you don't want to do.
A) It's not in WAR format, so it won't work reliably.
B) It's a massive security exposure.
C) It's likely to make chopped liver out of the webapps within TOMCAT_HOME/webapps, because - as I said - a WAR cannot contain another WAR.
subject: image not loading in jsp deployed inside webapps ROOT folder