The superclass “javax.servlet.http.HttpServlet” wa

2020-01-27 08:51发布

I have a project created by Maven integration in Eclipse. All work fine, but in the work space in all JSP files have this:

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

To the first string where place:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

When I create a basic dynamic web project and JSP in - all is fine, no errors.

14条回答
太酷不给撩
2楼-- · 2020-01-27 09:32

Project → PropertiesTarget Runtimes → *Apache Tomcat worked for me. There is no Target Runtimes under Facets (I'm on Eclipse v4.4 (Luna)).

查看更多
做自己的国王
3楼-- · 2020-01-27 09:32

And if nothing works by whatever reason, build it from the command line:

ant -Dj2ee.server.home=D:\apache-tomcat-8.0.23 clean

ant -Dj2ee.server.home=D:\apache-tomcat-8.0.23 compile

ant -Dj2ee.server.home=D:\apache-tomcat-8.0.23 dist
查看更多
登录 后发表回答