當我嘗試在 scritplet 中使用“pageContext”時,我遇到了 JSP 檔案的問題。
<%
String message = pageContext.getException().getMessage();
String exception = pageContext.getException().getClass().toString();%>
IDEA 拋出一個錯誤:“無法決議方法 'getException()'”,但我也在 E??clipse IDE 中嘗試了這段代碼,一切正常。
在我的 pom.xml 檔案中,我有所有 servlet 依賴項。
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
uj5u.com熱心網友回復:
你需要jsp-api依賴:
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>

轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/471493.html
