aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Small Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Small Doubt" Watch "Small Doubt" New topic
Author

Small Doubt

Rajan Chinna
Ranch Hand

Joined: Jul 01, 2004
Posts: 320
Why there are some methods and variables which start with _ (underscore) character in JSP servlet java file? Is there any special purpose behind that?
K Anshul
Greenhorn

Joined: Oct 20, 2004
Posts: 6
I think it refers to methods and variables which are generated by the server and which u shouldn't override in ur code.
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Different application server will generate different set of the code, even with the same JSP, and thus, I guess this is just their own preference.

As if you follow the coding practice stricty, you wont write your code variables started with "_".

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Mary Wallace
Ranch Hand

Joined: Aug 25, 2003
Posts: 138
But most of the application sever generate class files starting with "-".
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
The coding practice is to assure the readability and the standard, however, there should be no/less people who will read the generated codes, just like we seldom read EJB Stubs.

Thus, this is not a big deal indeed.

Nick
Bryan Basham
author
Ranch Hand

Joined: Apr 30, 2001
Posts: 199
Originally posted by Rajan Chinna:
Why there are some methods and variables which start with _ (underscore) character in JSP servlet java file? Is there any special purpose behind that?


The only member of a JSP servlet class that must use the underscore is the _jspService method, which is part of the JSP API standard. All other uses of underscore are the parlance of the container's JSP engine (as others have mentioned already).

-Bryan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Small Doubt