Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Apache Wicket Interview Questions and Answers

Question: 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
 
}
 
}
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook