找不到“http://www.atg.com/taglibs/json”的标记库描述符

时间:2018-04-26 13:40:20

标签: jsp jstl

我正在尝试将JSON taglib用于我的JSP页面,但我收到此错误

Can not find the tag library descriptor for "http://www.atg.com/taglibs/json"

我添加了标签lib,

<%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %>

我正在使用环境Java 1.8

如果我能以任何其他方式解析JSP中的JSON数据,请给我任何建议。

我已添加截图,请参见下文,

enter image description here

2 个答案:

答案 0 :(得分:0)

添加: -

<%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %> 
 and 
<%@page import="com.google.gson.JsonObject"%>

OR

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
import="org.json.JSONObject,org.json.JSONException,java.util.*"%>

位于Jsp页面的顶部。

答案 1 :(得分:0)

最后,我发现了什么问题。它缺少JSON-taglib依赖。

您需要添加以下依赖项

<!-- https://mvnrepository.com/artifact/atg.taglib.json/json-taglib -->
<dependency>
    <groupId>atg.taglib.json</groupId>
    <artifactId>json-taglib</artifactId>
    <version>0.4.1</version>
</dependency>

如果您收到类似缺失工件的错误,只需从下面的链接下载jar和pom文件并将其放到您的c:\ users \ .m2文件夹

JSON-taglib files