quarta-feira, 12 de novembro de 2008

Problems using ServletContext.getRealPath

Hi,

having problems using this in a servlet doGet or doPost method!?

"Cannot make a static reference to the non-static method getRealPath(String) from the type ServletContext" perhaps ?

or ...

"Cannot instantiate the type ServletContext" !?

use it like this!

getServletConfig().getServletContext().getRealPath("/");

or :

this.getServletContext().getRealPath("/")

Sem comentários: