Я пытаюсь интегрировать JSON с помощью JQuery AJAX-запроса в JSP. Я использую для этого пакет org.json.simple. С клиентской стороны все в порядке, но из-за ответа сервера я получаю 500 кодов ошибки сервера и 4 кода ReadyState.
Ответ, который я получаю:
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 12 in the generated java file
Only a type can be imported. org.json.simple.JSONObject resolves to a package
An error occurred at line: 15 in the jsp file: /interceptor_primaryengine_save.jsp
JSONObject cannot be resolved to a type
12: <body>
13: <%
14:
15: JSONObject obj = new JSONObject();
16:
17: String value = request.getParameter("value");
18: obj.put("value",value);
An error occurred at line: 15 in the jsp file: /interceptor_primaryengine_save.jsp
JSONObject cannot be resolved to a type
12: <body>
13: <%
14:
15: JSONObject obj = new JSONObject();
16:
17: String value = request.getParameter("value");
18: obj.put("value",value);
Stacktrace:
JSP-код, который я использую для отправки ответа:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page
import="org.jdom.*,java.util.*,org.jdom.input.SAXBuilder,org.jdom.output.XMLOutputter,java.io.*,org.jdom.filter.*,org.json.simple.JSONObject"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
JSONObject obj = new JSONObject();
String value = request.getParameter("value");
obj.put("value",value);
out.print(value);
out.flush();
%>
</body>
</html>
Я использую Eclipse IDE. Я импортировал файл JAR в проект. Я перезапустил сервер и перезапустил затмение тоже.
Что я тут не так делаю?