Eclipse开发Web应用经典错误整理(持续更新中...)

1. The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path.

    该错误提示一般出现在jsp文件的第一行。

第一步,右击项目名称,在菜单中选择"Build Path"-->"Configure Build Path...",将出现下面的窗口。

Eclipse开发Web应用经典错误整理(持续更新中...)
第二步,点击“Add Library..”,选择"Server Runtime",在列表中选择一个主机已经安装的Tomcat服务器,点击完成。
Eclipse开发Web应用经典错误整理(持续更新中...)

2. Server Tomcat v8.0 Server at localhost failed to start.

 
    出现这种错误一般是web.xml配置文件中<url-pattern>标签中的匹配错误。比如配置的Servlet、Struts框架、Struts2框架等中的<url-pattern>。<url-pattern>中的匹配错误还有可能会在运行中出现404错误,请读者注重配置文件中<url-pattern>标签的设置。

Servlet中的URL Pattern有四种格式:

(1)以“/”开头和以"/*"结尾:这种模式用于匹配一个路径前缀,比如"/login/*"可以匹配"/login/aaa"、"login/bb/a.html"等;

(2)以前缀"*."开始:这种模式用于匹配以一种后缀结束的路径,比如"*.do"可以匹配"/aaa.do"、"/bb/cc/d.do"等;

(3)字符“/”:这种模式只用于来表示default Servlet;

(4)一个以"/"开头的字符串,并且不符合以上的任何一种格式:除了上面的三种格式以外,其他合适都被用于精确匹配。比如“/register”只能被用于匹配路径“/register”。


3. Referenced file contains errors (http://struts.apache.org/dtds/struts-2.0.dtd). For more information, right click on the message in the Problems View and select "Show Details..."


找不到Struts框架的DTD文件。需要在Eclipse中进行配置。

第一步:点击Eclipse菜单项Window-->Preferences显示如下窗口

Eclipse开发Web应用经典错误整理(持续更新中...)

第二步:在左侧列表中选择XML-->XML Catalog。在右侧窗体中点击“Add”,会出现如下窗口

Eclipse开发Web应用经典错误整理(持续更新中...)

第三步:点击“File System”,在出现的浏览文件窗口中选择需要的DTD文件。一般存放在struts框架根目录下的\src\core\src\main\resources中。选择好DTD文件后,在“Key”编辑框中填写:-//Apache Software Foundation//DTD Struts Configuration 2.0//EN,点击“OK”退出

Eclipse开发Web应用经典错误整理(持续更新中...)

第四步:在xml文件中任意位置敲入一个空格并保存。

4. Referenced file contains errors(http://www.springframework.org/schema/beans/spring-beans-3.0.xsd).For more information, right click on the message in the Problems View and select "ShowDetails..."

    这个问题是缓冲问题,应该是缓冲中有相关的配置和当前定义冲突。

    第一步:解决方法:打开Windows->Preferences -> General ->Network Connections -> Cache

Eclipse开发Web应用经典错误整理(持续更新中...)

    第二步:点击 “Remove All”清空。

上一篇:排序算法之桶排序


下一篇:排序算法之地精排序