天天看點

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;

jsp頁面錯誤如下提示:

問題一:

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;

缺少運作環境,配置java Build Path——>Libraries——> Add Library

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;

選擇MyEclipse Server Library

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;

選擇内置的Tomcat,也可以加入外部Tomcat,依次選擇Finish/Applay确認選擇

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;

問題二:

Multiple annotations found at this line:

    - String cannot be resolved to a type

    - The method getContextPath() from the type HttpServletRequest refers to the missing type 

     String

Multiple annotations found at this line:

    - String cannot be resolved to a type

    - The method getServerName() from the type ServletRequest refers to the missing type 

     String

    - The method getScheme() from the type ServletRequest refers to the missing type 

     String

如圖:

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;

選擇JRE System Library 

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;

選擇所需的版本,依次選擇apply确認選項

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;

添加完如圖所示,選擇apply and close完成配置

jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;
jsp頁面報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java;