5.4  Documenting Source Code with the Javadoc Utility 
A task that is often not paid enough attention to is the documentation of the source code, 
although this is crucial to achieve high maintainability of the product, as well as reusability of 
Furthermore, in a project involving multiple developers, the developers have to interface with 
classes that other members of the team have written. Most likely, they will also want to use the 
methods of those classes. It is obvious that this is only possible if the classes are documented 
well, and the documentation is made available to the team members not at the end, but as early 
as possible in the development process. 
A great tool to document Java source code is the Javadoc utility. Javadoc generates 
documentation in HTML format, including package trees, an index, and sophisticated navigation 
and cross references. Since Sun Microsystems uses the same tool to generate their API 
reference documentation, the interface is well known to the Java developer community, and 
therefore easily understood.  
The Apache Software Foundation has already provided the basis to use Javadoc in their 
build.xml file for application development with Tomcat. To automatically generate the HTML 
documentation for the Web application, there are only a few steps required, which are outlined 
Step1: When writing your source code, comment it according to the format specified by the 
Javadoc documentation (see references). Basically, documentation text is inserted prior to each 
class and method declaration. Tags starting with an 
 symbol have a special meaning and are 
interpreted by the Javadoc compiler (please refer to the Javadoc documentation for a complete 
list of available tags). 
* Servlet to demonstrate the MultipartRequest class by Jason Pell.
* @author
W.Andreas Klimke (MIT)
* @see MultipartRequest
public class UploadExample extends HttpServlet {
* Uploads a file to the /uploadDir directory.
* @param req the request object
* @param res the response object
* @throws ServletException
* @throws IOException

Java Web Hosting Application Development Using Java Technologies Hosting

TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.