Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.sction.mvc.viewrender;
 
 
 
public class JSONViewRender implements ViewRender {
	public void render(ServletContext servletContext,
			Object objString encodingController controllerAction actionthrows Exception {
		response.reset();
		response.setCharacterEncoding(encoding);
		PrintWriter out3 = response.getWriter();
		response.setContentType("application/json; charset="
encoding);
		response.setHeader("Cache-Control""no-cache");
		ObjectMapper om = new ObjectMapper();
		out3.print(om.writeValueAsString(obj));
		out3.flush();
		out3.close();
	}
New to GrepCode? Check out our FAQ X