• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

servlet cant see getServletContext() from inheritance

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think all your subclasses will need to define

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

?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic