1. 程式人生 > >關於 javax.servlet.jsp.PageContext cannot be resolved to a type

關於 javax.servlet.jsp.PageContext cannot be resolved to a type

問題:當從一個專案中拷貝jsp檔案到另一個專案中出現報錯:javax.servlet.jsp.PageContext cannot be resolved to a type

解決方法一:新增依賴(推薦)

<!-- 防止 jsp 報錯 -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.1.0</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.2.1-b03</version>
		</dependency>


解決方法二:將專案部署到tomcat服務當中


這種問題的解決辦法是把這個專案在伺服器上部署一下就可以了,如下: