java_web提示错误

来源:互联网 发布:杰森伯恩 知乎 编辑:程序博客网 时间:2024/06/15 16:07

错误1:
JSP页面顶端出现“红色”的报错信息:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
办法:右击web工程-》属性或Build Path-》Java Build Path->Libraries-> Add Libray…->Server Runtime -》Tomcat Server;
切换到Java Build Path界面中的Orader and Export,选择Tomcat。

错误2:
Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment.
办法:右键Build Path-》Configure Build Path-》Remove the “JRE System Library[J2SE 1.5]”-> click “Add Library” button -> JRE System Library-> select the new “Executin Environment” or Workspace default JRE

错误3:
The method toLocaleString() from the type Date is deprecated deal.jsp /3/WebContent line 16 JSP Problem
办法:因为toLocaleString()方法老了不建议用,可以换成SimpleDateFormat类的方法

错误4:打开eclipse中Run on Server时,却显示“此程序无法显示网页”?
办法:首先关闭当前的tomcat服务器,之后在tomcat安装目录下tomcat/bin/tomcat7.exe双击,手动重新打开。此时在浏览器输入http://localhost:8080会出现tomcat起始迎接页,说明服务器已成功打开。

错误5:Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at localhost are already in use.
办法:启动任务管理器,结束javaw.exe

错误6:不能在45s内启动。还有启动后一直没反应
办法:重启电脑。也可以双击tomcat/bin/shutdown.bat来关闭tomcat试试,不行就算。

错误7:The method getRealPath(String) from the type ServletRequest is deprecated
办法:换个新方法 getServletContext().getRealPath(“index.jsp”)

0 0