How to add Javadoc for Servlet API in Eclipse

I have a dynamic web application in Eclipse that uses Tomcat as a runtime.

I can't add the Javadoc path Tomcat Servlet API: as it appears, the edit button is always disabled!

alt text http://filaty.com/i/1005/80306/tom.JPG

+7
eclipse tomcat servlets javadoc
source share
5 answers

In the package explorer of your project, go to Java Resources> Libraries. Rightclick servlet-api.jar , select "Properties" and specify the source location there ( apache-tomcat-xxx-src.zip file).

Another way is to simply open any servlet API class using Ctrl + Shift + T or Ctrl + Click on any import / declaration in the existing code, and then click the "Attach file ..." button and specify it there.

+14
source share

You can download the source banks for the api servlet from Maven and either create your own javadoc jar or just use the sources.

+6
source share

First , download the "Full Documentation" from the tomcat website. As an example for tomcat 8.5.23: https://tomcat.apache.org/download-80.cgi

full tomcat documentation

You will get a tar.gz file that you have to unzip since eclipse can only read folders or zip / jar.

Second , set the Javadoc location for your Tomcat library and "servlet-api.jar" in your Java build path. Point to the folder "(...) \ tomcat-8.5-doc \ servletapi":

eclipse tomcat servlet-api.jar

And now the eclipse will show you the correct Javadoc: enter image description here

+2
source share

I was constantly trying to pin sources for javax. libs properly without result, until it found that in some cases, for some reason, Eclipse messed up the connection between .jar and its classes. For example. when I clicked on Attach Source ... for HttpServlet.class this option to provide sources for my gwt-user.jar lib confused me a bit.

Therefore, you can try playing with the priority of your libraries in Project> Properties> Java Build Path> Order and Export to place your kit on top of the rest (for example, put the Apache Tomcat v7.0 library higher than the GWT SDK ). Also, on the Libraries tab, specify the correct source archive for servlet-api.jar , for example apache-tomcat-7.0.22-src.zip . Magically the problem is solved in the end.

0
source share

In the package explorer of your project, go to Java Resources> Libraries. Rightclick servlet-api.jar, select "Properties" and specify the source location there (apache-tomcat-xxx-src.zip file).

or

In the package explorer of your project, go to Java Resources> Libraries. Rightclick servlet-api.jar, select "Properties" and indicate the source location there ( http://docs.oracle.com/javaee/7/api/ ). This will give a direct link to the api on the Internet.

0
source share

All Articles