i'm using the below code for getting the json using struts2-hibernate, In the method getZone i used HttpServletResponse response= (HttpServletResponse) ActionContext.getContext().get(StrutsStatics.HTTP_RESPONSE);
for returning the json. The code works fine, but i'm a bit confused and would like to know whether there is any other in struts2 in which we can achieve the same job, like using some other struts2 in-built method for HttpServletResponse.
Can anyone please tell me some solution for this
public void getZone() {
HttpServletResponse response= (HttpServletResponse) ActionContext.getContext().get(StrutsStatics.HTTP_RESPONSE);
try {
JSONObject zoneAreas = Hibernateclass.getZone(Id, organId);
response.getWriter().write(zoneAreas.toString());
} catch (IOException e) {
e.printStackTrace();
}
}