How to get root context of web application in Wicket
Published: May 27, 2009 , Updated: May 31, 2011 , Author: mkyong
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