aspose file tools*
The moose likes Servlets and the fly likes servlet cant see getServletContext() from inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet cant see getServletContext() from inheritance" Watch "servlet cant see getServletContext() from inheritance" New topic
Author

servlet cant see getServletContext() from inheritance

EM. Lashkar
Greenhorn

Joined: Jan 31, 2003
Posts: 9
Hi there ,
While implementing MVC architecture ,
I made an abstract ParentController.java which is extended by ApplicationController.java. In the ApplicationController I am doing :
// get the application object
ServletContext app = getServletContext();

// select login.jsp as the template
RequestDispatcher disp;
disp = app.getRequestDispatcher("index.jsp");
and at compile time I am getting:
ApplicationController.java:46: cannot resolve symbol
symbol : method getServletContext ()
Any idea? Thanks in advance for your comments .
Here are the code of the 2 classes :
----------------------------------------------

----------------------------------------------
----------------------------------------------

[ December 15, 2003: Message edited by: Mike Curwen ]

ML
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I think all your subclasses will need to define

public void init(ServletConfig config) throws ServletException {
super.init(config);
}

?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet cant see getServletContext() from inheritance