The moose likes Servlets and the fly likes getServletName() method error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "getServletName() method error" Watch "getServletName() method error" New topic

getServletName() method error

Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
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

Joined: Sep 05, 2000
Posts: 523

What is "this"? I see no class here.
Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
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

Joined: Mar 18, 2004
Posts: 572
post the stack trace of that exception you are facing?
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 642
Try this
System.out.println(getServletConfig().getServletName() + ": init()");

All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
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

Joined: May 27, 2004
Posts: 28

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.

Thanks <br />Kavitha G <br />SCJP
I agree. Here's the link:
subject: getServletName() method error
It's not a secret anymore!