Still not sure why Eclipse complained about request.getSession().getServletContext()).getContextPath() anyway request.getContextPath() is enough see bottom of oracle.com/javaee/6/api/javax/servlet/ServletContext.html#method_detail