This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Help to identify this object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help to identify this object" Watch "Help to identify this object" New topic
Author

Help to identify this object

Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
Hello Struts gurus....

this is a snippet from a code of a class extending Action class.....

Please let me know which object does the variable 'servlet' refer to?


// Log this event, if appropriate
if (servlet.getDebug() >= Constants.DEBUG) {
StringBuffer message =
new StringBuffer("LogonAction: User '");
message.append(username);
message.append("' logged on in session ");
message.append(session.getId());
servlet.log(message.toString);
}


Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
Any ideas guys?

Thanks!
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137
servlet.getDebug()
and other methods in your example definitely does not belong to HttpServlet class.
You have the access to the code you can simply see the method in which this code appears. See the method arguments.


Paras Jain
SCJP 5.0
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
In this code, the servlet variable is referring to the Struts ActionServlet. It's clear, though, from the use of the getDebug() method that this code was written for Struts version 1.0 because in later versions this method is deprecated. Later versions use Apache Commons logging and don't use this debug flag in the ActionServlet.


Merrill
Consultant, Sima Solutions
 
GeeCON Prague 2014
 
subject: Help to identify this object