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;