| 1. |
How To Get Servletcontext In Apache-wicket Application? |
|
Answer» Yes, you can GET the SERVLETCONTEXT class via Wicket’s WebApplication class like this : import javax.servlet.ServletContext; import org.apache.wicket.PAGE; import org.apache.wicket.protocol.http.WebApplication; import com.withoutbook.hello.Hello; public class CustomApplication extends WebApplication { @Override public Class<? extends Page> getHomePage() { ServletContext servletContext = WebApplication.get().getServletContext(); return Hello.class; //return default page } } Yes, you can get the ServletContext class via Wicket’s WebApplication class like this : import javax.servlet.ServletContext; import org.apache.wicket.Page; import org.apache.wicket.protocol.http.WebApplication; import com.withoutbook.hello.Hello; public class CustomApplication extends WebApplication { @Override public Class<? extends Page> getHomePage() { ServletContext servletContext = WebApplication.get().getServletContext(); return Hello.class; //return default page } } |
|