• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

GenericServlet

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GenericServlet implements Servlet and ServletConfig.
I am however getting the following exception..

generic.java:19: cannot resolve symbol
symbol : method getServletName ()
location: interface javax.servlet.ServletConfig
String ss = servletConfig.getServletName();
Code is :
public class generic extends GenericServlet
{
public void service(ServletRequest request, ServletResponse response)throws ServletException,IOException{
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
ServletConfig servletConfig = getServletConfig();
String ss = servletConfig.getServletName();
pw.println(".."+ss);
}
}
 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeffrey
I ran your code asis and had no problems. It compiled ok and, when run, returned "..generic".
Are there any other bits to your code that you can show us?
Mark.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeffrey,
I think you didnot add Servlet.jar into your CLASSPATH.
 
Jeffrey Pony
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I accept that its a strange problem but it is finding GenericServlet, ServletRequest,ServletResponse, ServletConfig also..so it is finding servlet.jar from the classpath.
Iam using tomcat from the Cd that comes along with hanumant's book and jdk1.3.I guess that the version is tomcat 4.0.
Mark : Couple of more lines but those were pw.printlns which seemed fine !!
 
This tiny ad is guaranteed to be gluten free.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic