HttpServlet cannot be resolved to a type && Tomcat創建Servlet出現異常

HttpServlet cannot be resolved to a type

異常現象:
img

錯誤提示:
- HttpServlet cannot be resolved to a type

問題:
 發現HttpServlet這個類根本就找不到,於是乎問題找到了—-沒有這個庫;

解決思路:
 引入相關庫.

本例中遇到是在tomcat使用嚮導創建Servlet後出現的現象.下面是解決方案:

1. 右鍵工程菜單—properties

image

2. 選擇Java Build Path → Libraries → AddLibrary

image

3. 選擇 Server Runtime

img

4. 設置自己的服務器

img

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章