[轉]The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
完整錯誤信息:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THECOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING INANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE.
Description Resource Path Location Type
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path add.jsp /dwz-Java/WebContent/WEB-INF/jsp/management/news line 1 JSP Problem
簡而言之:沒有配置Web服務器。
在出現此錯誤的項目上單擊鼠標右鍵-->Build Path-->Configure Build Path
到了添加Server Library步驟時,裏面是空選項,沒有Tomcat 7.0選擇,怎麽辦?
1、選擇 eclipse 的WIndows菜單》Preferences 預設
2、在左側列表中找到 Server 項,展開,選中:Runtime Environments,右側點擊添加按鈕
3、這裏要根據你使用的 Tomcat 版本來選擇,不一定是 Tomcat 7.0;
我這裏是演示添加 Tomcat,當然也可以選擇添加 IBM 的 Liberty ,或者 JBoss 之類的 Web 服務器(Java EE容器)
如果你還沒有安裝 Tomcat,那可以去官網下載一個壓縮包解壓到一個目錄就可以了。
4、點擊 Browse 按鈕選擇 Tomcat 所在的位置
選擇 JRE (Java Runtime Environment),當然你可以使用 Eclipse 自帶的,
但如果你想使用自己安裝的版本就需要添加一下;初學使用自帶的就可以了;
5、上面一切就緒點擊 Finish 按鈕就可以了。
參考文檔:
http://blog.csdn.net/testcs_dn/article/details/36455669
http://blog.csdn.net/testcs_dn/article/details/70336604
[轉]The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path