Is it possible to store web content (such as JSPs, HTML, images, CSS etc) in a JAR file?
I\'ve been looking at various options at modularising our web applications and t
Yes, it is possible to store files e.g. properties, xml, xslt, image etc; in a JAR (or WAR) file and pull them at runtime.
To load a resource from your deployment jar, use the following code.
this.getClass().getClassLoader().getResourceAsStream( filename ) ;
In a maven project, folders & files placed in resources are included in the jar. The filename is relative to the root of jar file, so "./filename.xml" would match the file filename.xml placed in "/src/java/resources".