I've a dynamic web 开发者_StackOverflowapp in Eclipse that is using Tomcat as runtime environment.
I cannot add Javadoc path Tomcat Servlet API: as appears, the edit button is always disabled!
alt text http://filaty.com/i/1005/80306/tom.JPG
In Package Explorer of your project go to Java Resources > Libraries. Rightclick servlet-api.jar
, choose Properties and specify the source location there (the apache-tomcat-x.x.x-src.zip
file).
Another way is to just open any Servlet API class using Ctrl+Shift+T or by Ctrl+Click on any import/declaration in existing code and then click the Attach Source... button and specify it there.
You could download the source jars for the servlet api from Maven and either build your own javadoc jar or just use the sources.
First, download the "Full documentation" from the tomcat website. As Example for tomcat 8.5.23: https://tomcat.apache.org/download-80.cgi
You'll get a tar.gz file which you have to unzip since eclipse only can read folders or zip / jar.
Second, set in your Java Build Path the Javadoc location for library Tomcat and "servlet-api.jar". Point to the folder "(...)\tomcat-8.5-doc\servletapi":
And now eclipse will show you the correct Javadoc:
I've been continuously trying to attach the sources for javax.
libs in a proper way with no result, until I found that in some cases by some reason Eclipse is messing up the relationship between .jar and its classes. E.g. when I clicked upon Attach Source... for the HttpServlet.class
the given option to provide sources for my gwt-user.jar
lib confused me a little bit.
Hence one may try to play with the precedence of his libs at Project > Properties > Java Build Path > Order and Export to put your kit over the rest (e.g. put Apache Tomcat v7.0
library higher then GWT SDK
). Also at the Libraries tab provide the proper sources archive for servlet-api.jar
like apache-tomcat-7.0.22-src.zip. Magically the problem is solved after all.
In Package Explorer of your project go to Java Resources > Libraries. Rightclick servlet-api.jar, choose Properties and specify the source location there (the apache-tomcat-x.x.x-src.zip file).
or
In Package Explorer of your project go to Java Resources > Libraries. Rightclick servlet-api.jar, choose Properties and specify the source location there (http://docs.oracle.com/javaee/7/api/). This will give a direct link to the api online.
精彩评论