Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getServletName() method error

 
Linda Pan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is probably something simple, but I haven't been able to figure it out.
I am getting an error with the getServletName method. I am using the jsdk.jar version 2 with j2sdk1.4.1_01 compiler. My error is "cannot resolve symbol". Help.....


[ May 25, 2004: Message edited by: Linda Pan ]
 
Barry Andrews
Ranch Hand
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is "this"? I see no class here.
 
Linda Pan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also have another class that extends this one. It is rather lengthy but th abstract SametimeBot class should run but it doesn't recognize the method?

I'm thinking the version of jsdk.jar has something to do with the compile errors ... hmmmm....
[ May 26, 2004: Message edited by: Linda Pan ]
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
post the stack trace of that exception you are facing?
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try this
System.out.println(getServletConfig().getServletName() + ": init()");
 
Linda Pan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the method getServletConfig() didn't work. Good try though.
The stack trace, I assume is the error in the CMD box? I'm still getting the "cannot resolve symbol" compile error.

 
Kavitha Govindaraj
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

this.getServletName() is working. The reference this refers to the current servlet.

It is not neccessary that we need to have a class to refer it with this. In this case, this refers to the current HttpServlet.

I tried the same thing using j2sdk1.4.1_01. & is working perfect.
Kavitha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic