jspc-maven-plugin问题“会话无法解决”

时间:2020-07-02 08:23:50

标签: java maven jsp

使用此Maven插件(与JDK 1.7或JDK 1.8一起使用) https://sling.apache.org/components/jspc-maven-plugin/index.html 我无法编译JSP。详细信息:

 <plugins>
                    <plugin>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>jspc-maven-plugin</artifactId>
                        <version>2.1.0</version>
                        <configuration>
                            <sourceDirectory>${project.basedir}/src/main/webapp</sourceDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>compile-jsp</id>
                                <goals>
                                    <goal>jspc</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>javax.servlet</groupId>
                                <artifactId>servlet-api</artifactId>
                                <version>2.5</version>
                            </dependency>
                            <dependency>
                                <groupId>javax.servlet.jsp</groupId>
                                <artifactId>jsp-api</artifactId>
                                <version>2.1</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>

我收到此错误:

[ERROR] Failed to execute goal org.apache.sling:jspc-maven-plugin:2.1.0:jspc (compile-jsp) on project tol-web: Unable to compile class for JSP:
[ERROR] 
[ERROR] An error occurred at line: 56 in the jsp file: /xxx.jsp
[ERROR] session cannot be resolved
[ERROR] 55: int result;
[ERROR] 56:            if(session.getAttribute("result") != null){
[ERROR] 57:                 result = (Integer)session.getAttribute("result");
[ERROR] 58:                 session.removeAttribute("result");
[ERROR] 59:            }else{
[ERROR] 

为什么使用此插件编译jsp时无法获得会话(HttpSession)?

谢谢

0 个答案:

没有答案