Help with Java servlet : getServletContext().



I am newbie to Java, am trying to get a program working, and I have
imported the java packages below along with many other imports :
import javax.servlet.GenericServlet;
.....
xsltFile = new File(getServletContext().getRealPath("xslt/" +
template));
if(!xsltFile.canRead()) {
System.out.println("Error reading XSLT template file '"
+ xsltFile + "'.");
return 0;
}

I get the following error, can anyone tell me what the problem is?

com\netod\util\MyClass.java:243: cannot resolve symbol
symbol : method getServletContext ()
location: class com.netod.util.MyClass
xsltFile = new File(getServletContext().getRealPath("xslt/"
+ template));

thanks for any help

.



Relevant Pages

  • Re: Help with Java servlet : getServletContext().
    ... > imported the java packages below along with many other imports: ... > + template)); ... whole new type of servlet? ...
    (comp.lang.java.help)
  • Re: ActiveDocument Not Getting Set on Document Open
    ... I'm not sure what you are attaching your templates to every document that's ... should consider using a global template, and make your menu changes to it. ... > I am having troubles with implementing a CommandBar in Microsoft Word ... > Imports Office.MsoControlType ...
    (microsoft.public.office.developer.com.add_ins)
  • Re: Help with Java servlet : getServletContext().
    ... >> I am newbie to Java, am trying to get a program working, and I have ... >> imported the java packages below along with many other imports: ... instance variables (where you have a local variable of the same name, ...
    (comp.lang.java.help)
  • asp.net page template *inheritance)
    ... reference and points to the statement PageBase.Render. ... I create the template by overriding the System.Web.UI.Page.Render method. ... Imports System.Web.UI ... ' Then we allow the base class to render the ...
    (microsoft.public.dotnet.framework.aspnet)
  • updating links in a macro
    ... I'm attempting to write a basic macro that imports from an excel file ... the template file changes. ...
    (microsoft.public.excel.misc)