package surc.test;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONObject;

/**
 * Servlet implementation class NewComment
 */
@WebServlet("/newComment")
public class NewComment extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public NewComment() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("application/json; charset=UTF-8");

		PrintWriter out = response.getWriter();
		JSONObject obj = new JSONObject();
		obj.put("status", "ok");
		out.println(obj);
	}
}

@@ -301,39 +301,8 @@
 %0D%0A%0D%0A
-import org.json.JSONObject;%0D%0A%0D%0A
 /**%0D
@@ -919,132 +919,299 @@
 %0D%0A%09%09
-PrintWriter out = response.getWriter();%0D%0A%09%09JSONObject obj = new JSONObject();%0D%0A%09%09obj.put(%22status%22, %22ok%22);%0D%0A%09%09out.println(obj
+// To submit the comment, you need to load the comment content by a%0D%0A%09%09// parameter name %22comment%22 first. Additionally, you need to add all the%0D%0A%09%09// files into database as well, which still remain in session.%0D%0A%0D%0A%09%09PrintWriter out = response.getWriter();%0D%0A%09%09out.println(%22%7B%5C%22status%5C%22:%5C%22ok%5C%22%7D%22
 );%0D%0A

Update Example - Submit New Comment