(转载)eclipse中tomcat 编写web 出现 servlet-api.jar has no source attachment 问题
来源:互联网 发布:jquery.md5.js cdn 编辑:程序博客网 时间:2024/06/07 12:27
eclipse中tomcat 编写web 出现 servlet-api.jar has no source attachment 问题
https://www.iyunv.com/forum.php?mod=viewthread&tid=96915&fromuid=272238
(出处: 运维网)
这几天想通过james来完成邮件服务器的假设,做了一个简单的web程序验证,在服务端跳转的时候出现了问题,debug时执行了但是就是没有出现页面跳转,debug的结果是
!!!!表面现象:.../TOMCAT_HOME/servlet-api.jar has no source attachment 自己找了一下发现自己在build path 添加了,而且在../tomcat/lib/中也存在servlet.jar,就是找不到问题所在,就是google,最后在csdn上有一个相同遭遇的哥们(也可能是姐姐),最后他没有解决,玩两把CS后,我做了一下修改
把servlet程序中出现的跳转语句
request.getRequestDispatcher(url).forward(request, response);
改为
RequestDispatcher rd=request.getRequestDispatcher(url);
rd.forward(request, response);
重启tomcat服务器,然后运行就莫名其妙的完成率跳转,不容易啊!花了几个小时就突然解决了,没有太多的兴奋,感觉就是eclipse可能也有bug,写点,希望有碰到类似情况的有所帮助。
问题解决:
安装好了tomcat之后,在编译.java文件的时候出错:软件包 javax.servlet 不存在
原来这个包在web服务器才有,j2se中并没有,所以导致了错误。
解决方法:
方法(1) 找到%tomcat%\common\lib目录下的servlet-api.jar,把这个路径添加到环境变量classpath当中,就可以了。(这个好像不是很管用,我重装了tomcat之后,再重新配置好像就不行了)
方法(2) 找到%tomcat%\common\lib目录下的servlet-api.jar,把这个jar添加到%java_home%/\jdk1.6.0\jre\lib\ext目录下面,不同的jdk版本都一样。
这种情况会导致很多Bug出现,建议采用方法(2)彻底解决问题。
希望帮助初入门的Java爱好者
大家有个参考!!!!!
最后感谢,apache的james邮件服务器!!!!!
阅读全文
0 0
- (转载)eclipse中tomcat 编写web 出现 servlet-api.jar has no source attachment 问题
- 解决eclipse中查看android工程代码出现android.jar has no source attachment
- 解决eclipse中查看android工程代码出现android.jar has no source attachment
- 解决eclipse中查看android工程代码出现android.jar has no source attachment
- 解决eclipse中查看android工程代码出现android.jar has no source attachment
- 解决eclipse中查看android工程代码出现android.jar has no source attachment
- 【图】解eclipse 查看原始类出现The jar file rt.jar has no source attachment
- eclipse 查看原始类出现The jar file rt.jar has no source attachment解决方法
- eclipse 查看原始类出现The jar file rt.jar has no source attachment解决方法
- Eclipse 查看源码出现 The jar file rt.jar has no source attachment 解决方法
- eclipse 查看原始类出现The jar file rt.jar has no source attachment解决方法
- eclipse 查看原始类出现The jar file rt.jar has no source attachment解决方法
- eclipse 查看原始类出现The jar file rt.jar has no source attachment解决方法
- Myeclipse出现the jar file xxx.jar has no source attachment. 问题
- eclipse查看不了源码(the jar file has no source attachment)解决方法
- XXX.jar has no source attachment 解决方法
- hibernate3.jar has no source attachment
- 图解myEclipse 查看原始类出现The jar file rt.jar has no source attachment
- 666
- input输入框点击有边框的解决办法
- 卡尔曼滤波学习笔记
- 在java中使用任务调度定时进行运行环境检测
- 企业实战之Spring拦截器+注解实现《登录校验》
- (转载)eclipse中tomcat 编写web 出现 servlet-api.jar has no source attachment 问题
- 坚持#第215天~零基础自学云计算基础语言应用16~20节
- 消愁
- pycharm安装
- Ubuntu 16.04 Java8 安装
- java.lang.UnsupportedClassVersionError 版本不一致错误
- java配置和eclipse配置
- java中FileInputStream的available() 方法的作用
- 手把手教你给一个iOS app配置多个环境变量