Hi, I'm trying to compile a jsp with the following line of code. <%@ page language="java" import="java.io.*" %> <% String dbPath = getServletContext().getRealPath("/WEB-INF/myData.db"); %> I keep getting the following error:- method getServletContext() not found in class. Any suggestions??.
posted 13 years ago
Hi Mark, If the real intention is to get the real path you can probably replace that code with this <% String realPath = application.getRealPath("/WEB-INF/myData.db"); %>
application object represents the servletContext and is an implicit object available in jsp. :-)