본문 바로가기
JAVA/error

[Servlet & JSP] eclipse import error

by sihyeong 2023. 9. 6.

발생한 에러

  • WebServlet cannot be resolved to a type
  • HttpServlet cannot be resolved to a type
  • HttpServletRequest cannot be resolved to a type
  • HttpServletRequest cannot be resolved to a type

발생 시점

  • github에서 servlet/jsp 프로젝트를 eclipse로 열고 import 직후 발생

해결 방법

1. 사용할 was서버 등록

  • 프로젝트 우클릭 --> properties --> Server --> Runtime Environments --> Add


2. Dynamic Web Project 환경 설정

  • 프로젝트 우클릭 --> properties --> Project Facets --> Dynamic Web Module, Java, JavaScript 체크


3. WAS(Tomcat) Build Path 등록

  • 프로젝트 우클릭 --> Build Path --> Configure Build Path --> Libraries --> Add Library --> Server Runtime


위의 3가지를 확인하면 import한 servlet/jsp 프로젝트가 오류없이 동작할 것이다.