27 June 2012

Get the WEB-INF folder path

. 27 June 2012 .

This is a simple example on how to get the WEB-INF directory path in a J2EE web application.

public class MyClassName{

private static final String WEBINF = "WEB-INF";

public String getWebInfPath(){

String filePath = "";

URL url = MyClassName.class.getResource("MyClassName.class");
String className = url.getFile();

filePath = className.substring(0,className.indexOf(WEBINF) + WEBINF.length());
return filePath;
}

}

0 comments:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Post a Comment

 
{nama-blog-anda} is proudly powered by Blogger.com | Template by Agus Ramadhani | o-om.com