Is there any way I can read getServletContext() in a normal static java method? i.e. a class which is not a servlet
My web.xml contains:
<context-param>
<param-name>paramname</param-name>
<param-value>test value</param-value>
</context-param>
and static class:
public classname
{
public static boolean methodname()
{
String name=javax.servlet.GenericServlet.getServletContext().getInitParameter("paramname");
// other processing
}
}
I know I cannot access non-static method from a static class but trying to get a workaround.
I can do this is a servlet class. However my JSP page is calling a static method. Is there any workaround?