In Wicket, you can use following method to get the “root context” of your project.

WebApplication.get().getServletContext().getServletContextName()

For example,

public static String getRootContext(){
 
		String rootContext = "";
 
		WebApplication webApplication = WebApplication.get();
		if(webApplication!=null){
			ServletContext servletContext = webApplication.getServletContext();
			if(servletContext!=null){
				rootContext = servletContext.getServletContextName();
			}else{
				//do nothing
			}
		}else{
			//do nothing
		}
 
		return rootContext;
 
}
Any Java questions or problems? please post at this JavaNullPointer.com forum, see you there ~
[ Read More ] You can find more similar articles at Apache Wicket Tutorials