In eclipse, you can Ctrl+左键单击
view the source code:
but when you first start using it, the following situation will occur:
find the installation location of jdk, you can see a src.zip file, this is the source code of jdk, we first copy the path:
click Attach Source… button to configure:
You can also click: window-”preferences-”java-”Installed JREs
to find the path at the end of rt.jar, and then click Source Attachment…
Click to select External location, and paste the previously copied path directly:
You can also click External File…, find src.zip for configuration:
Use Ctrl+left-click to view the source code:
When we look at the source code of the servlet, we find that we can't view it:
Download the Tomcat source code: https://tomcat.apache.org/
Click Attach Source again, select the compressed package we just downloaded:
Then you can view the source code of the Servlet: