报错:Failed to load resource: the server responded with a status of 500 (Internal Server Error)

之前在做树形菜单的时候,一直在报一个错误:Failed to load resource: the server responded with a status of 500 (Internal Server Error)怎么也找不到是哪里出了问题,

在这里插入图片描述
在F12调试的时候一直都有数据,但是就是绑定不上页面去,:
报错:Failed to load resource: the server responded with a status of 500 (Internal Server Error)_第1张图片
后来去找后台,才发现没有把json格式的数据输出到前台去,
写了一个专门在前台输出数据的方法:

/**
	 * 写JSon
	 * 
	 * @param response
	 * @param object
	 *            需要传出去的东西
	 * @throws IOException
	 */
	public static void write(HttpServletResponse response, Object object) throws IOException {
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		out.println(object.toString());
		out.flush();
		out.close();
	}

在后台直接调用,把要输出的东西放上去就可以了。
报错:Failed to load resource: the server responded with a status of 500 (Internal Server Error)_第2张图片
之前也是有输出的,但是不知道什么时候我不小心删掉了,找这个问题找了好久,真的是犯了一个低级错误!

你可能感兴趣的:(Java)