I do an AJAX call using $.get() method and it's response is sent using the following servlet response object :
public void getStatisticsIndividualAnalysis() throws ParseException{
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/plain");
List<JSONObject> jsonReturnList = new ArrayList<JSONObject>(); // LIST to be returned through RESPONSE object
PrintWriter out;
out = response.getWriter();
}
I am using Struts2 framework. I feel using servlet response object is a bad practice. Is there a better approach to send response?? Please help by providing some code!