在JBoss服务器上,我有一个slice_new.tag文件
<%@ attribute name="action" %>
<%@ attribute name="icon" %>
<%@ attribute name="pageId" %>
<%@ attribute name="cost" %>
<%@ attribute name="co2" %>
<%@ attribute name="unit" %>
<%@ tag language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<title>${action}</title>
</head>
<body> ...
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个编译错误
在Java Build Path slice_new.tag上找不到超类"javax.servlet.jsp.tagext.SimpleTagSupport"
请帮我解决一下吗?
另外,我也找到了其他解决方案。有问题的类来自jsp-api.jar,因此我将其作为提供的依赖项添加到了我的构建中。在行家中,这看起来像这样。请注意,“提供的”作用域意味着不要将其捆绑在WAR中,因为预期它将由容器(例如Tomcat)提供
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)