Servlet-api.jar has no source attachment problem with Tomcat authoring web in Eclipse
https://www.iyunv.com/forum.php?mod=viewthread&tid=96915&fromuid=272238
(Source: Operation and Maintenance Network)
These days, I want to finish the mail server hypothesis through James, do a simple Web application verification, in the service side jump when there is a problem, when the debug is executed but there is no page jump, debug the result is .... Surface phenomena:
.../tomcat_home/servlet-api.jar has no source attachment found himself a bit in the build path added, and in the. /tomcat/lib/also exist Servlet.jar, is not find the problem, is Google, finally on the csdn have a similar encounter of the elder brother (also may be elder sister), finally he did not solve, play two Cs, I did a bit of modification
The jump statement that appears in the Servlet program
Request.getrequestdispatcher (URL). Forward (request, response);
Switch
RequestDispatcher rd=request.getrequestdispatcher (URL);
Rd.forward (request, response);
Restarting the Tomcat server, and then running on the inexplicable completion rate jump, not easy ah. It took a couple of hours to fix it, and there was not much excitement, and the feeling was that eclipse might have bugs, write points, and hopefully have a similar situation to help.
Problem solving:
After installing Tomcat, there was an error in compiling the. java file: Package Javax.servlet does not exist
Originally this package in the Web server only, J2SE did not, so caused the error.
Workaround:
Method (1) Find the Servlet-api.jar in the%tomcat%\common\lib directory, add this path to the environment variable classpath, it is possible. (This doesn't seem to work very well, after I re-installed Tomcat, I don't have to reconfigure it.)
Method (2) Locate the Servlet-api.jar in the%tomcat%\common\lib directory, add the jar to the%java_home%/\jdk1.6.0\jre\lib\ext directory, and the different JDK versions are the same.
This situation can lead to a lot of bugs, and it is recommended to use the method (2) To solve the problem completely.
Java enthusiasts who want to help beginners
We have a reference .....
Finally thanks, Apache's James Mail server .....