编辑:作为对评论的回应,我已经包含了JSP文件的起始部分,我正试图将OWASP库添加到其中。多个人指出了这一声明:
<%@ taglib prefix="e" uri="https://www.owasp.org/index.php/OWASP_Java_Encoder_Project" %>这个语句已经在JSP文件中了。我还在maven POM文件依赖项中添加了所需的jars。
以下是JSP文件的开头行。如您所见,文件中已经有多个taglib语句,它们已经被使用并且已经工作了。我无法解释为什么OWASP标记库不能工作。有人能提供一个有效的例子吗?
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="asrs" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="e" uri="https://www.owasp.org/index.php/OWASP_Java_Encoder_Project" %>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<asrs:cssPath relativePath="find.css" />
<asrs:dojoConfig relativePath="lib/dojo/dojo.js" configValue="parseOnLoad: true"/>
<asrs:javascriptPath relativePath="lib/dojo/io/iframe.js"/>
<asrs:javascriptPath relativePath="lib/spring/Spring.js"/>
<asrs:javascriptPath relativePath="lib/spring/Spring-Dojo.js"/>
<asrs:javascriptPath relativePath="Metadata.js"/>
</head>
<body onunload="javascript: exitpop()" onresize="resize()">
<c:if test="${saved}">
<script type="text/javascript" language="JavaScript">
top.close();
</script>
</c:if>
[code continues]原始员额:
我试图使用嵌入式Tomcat将OWASP标记库添加到Spring项目中。项目文档这里和另一个问题这里表明这应该是正确的:
<%@ taglib prefix="e" uri="https://www.owasp.org/index.php/OWASP_Java_Encoder_Project" %>
<p>Dynamic data via EL: ${e:forHtml(param.value)}</p>
<p>Dynamic data via tag: <e:forHtml value="${param.value}" /></p>但是我不能让Intellij识别这个标签库。我在项目中添加了两个OWASP依赖项,但似乎没有任何帮助:
<dependency>
    <groupId>org.owasp.encoder</groupId>
    <artifactId>encoder</artifactId>
    <version>1.2.3</version>
</dependency>
<dependency>
    <groupId>org.owasp.encoder</groupId>
    <artifactId>encoder-jsp</artifactId>
    <version>1.2.3</version>
</dependency>这个问题是与OWASP库有关还是与Spring有关?
https://stackoverflow.com/questions/74035324
复制相似问题