%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.io.*,java.util.*,javax.xml.bind.DatatypeConverter" %>
<%!
void writeDataToFile(File json_file, String json_data)
{
try {
FileWriter fw = new FileWriter(json_file);
BufferedWriter bfw = new BufferedWriter(fw);
bfw.write(json_data);
bfw.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
%>
<%
String doc_base = getServletContext().getRealPath("/");
File similarity_dir = new File(doc_base,"similarity-2d");
File similarity_data_dir = new File(similarity_dir,"json-data");
String json_data = request.getParameter("jsonData");
String json_filename = request.getParameter("jsonFilename");
if (json_filename == null) {
json_filename = "data.json";
}
File full_json_file = new File(similarity_data_dir,json_filename);
writeDataToFile(full_json_file,json_data);
out.println("");
%>