maven中Web子项目报错The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

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

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

</body>
</html>

在Java构建路径上找不到超类“javax.servlet.http.HttpServlet”。

解决办法:1.对着web子项目右击选择


2.Add Library..,


3.选择其中一个版本的tomcat


猜你喜欢

转载自blog.csdn.net/butterfly_resting/article/details/80143530