使用idea编辑jsp页面的时候,发现不能使用pageContext.setAttribute,爆红

为什么不能使用setAttribute呢?

在这里插入图片描述

原来是少了jsp-api这个依赖

<!-- https://mvnrepository.com/artifact/javax.servlet/jsp-api -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.0</version>
    </dependency>

添加之后,就可以使用了!!!

在这里插入图片描述

文章转载至:https://blog.csdn.net/pyfysf/article/details/78816719