File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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("' logged on in session ");

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

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

Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 138
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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Help to identify this object
It's not a secret anymore!