Adding javadoc links

Warning - java2web is now obsolete. Please use its successor: code2web

back to index

To add javadoc links, you must specify two things:

Why two values? Java2web explores the local location, reading all packages and all .html files lo cated in it in order to determine the fully qualified names of the classes. However, the fact that your copy of the Java 5 docs is located in "c:\program files\java5\docs" does not mean that when generating the HTML output, the class String will be linked to "c:\program files\java5\docs\java\lang\String.html" as this wouldn't make any sense for any remote user but you.

Thus, beside telling the system that you want to read all classes located in "c:\program files\java5\docs", you also need to tell it that for each class found, a link to "http://java.sun.com/j2se/1.5.0/docs/api" should be created.

You can supply as many pairs of (local javadoc,url to generate) as you want, but keep in mind that adding many javadoc sets eats up memory and greatly impacts performance.

Since java2web is not a compiler and does not build a syntax tree, it has no way of determining whether an identifier corresponds to a class or to some other thing, so it uses more or less the strategy "if I find the identifier in the list of classes that I know, then it must be a class". (But see "known problems" for situations in which this is not correct).

Adding javadoc locations is performed in the following ways:

HTMLConverter   void addJavadocLocation( String path, String url )
Java2Web   java2web ... --javadoc = "path,url,path,url ,... "
<j2w:convert>   <j2w:convert ... javadoc="path,url,path,url" ... >

If you are using HTMLConverter, you call the addJavadocLocation as many times as you need, one for each set of javadocs:

HTMLConverter conv;
...
conv.addJavadocLocation(
"c:\\java5\\docs\\api",
"http://java.sun.com/j2se/1.5.0/docs/api/");

conv.addJavadocLocation(
"c:\\javalib\\struts\\doc\\api",
"http://struts.apache.org/2.x/struts2-core/apidocs");

If instead you are using the java2web program or the tag, then you pass all values as a list of comma-separated values:

java2web -javadoc="c:\java5\docs\api,
http://java.sun.com/j2se/1.5.0/docs/api,
c:\javalib\struts\doc\api,
http://struts.apache.org/2.x/struts2-core/apidocs"

The style of the javadoc links is controlled by the javadocLinkStyle property. The default value is "javadoc-link"

 

HTMLConverter   String getJavadocLinkStyleStyle()
void setJavadocLinkStyle( String style )
Java2Web   java2web ... --javadocLinkStyle = xxxxx ...
<j2w:convert>   <j2w:convert ... javadocLinkStyle="style" ... >