引入了JSON相关依赖包(以下)
同时我也能看到net/sf/ezmorph/Morpher这个类(虽然它是个接口)
为什么在执行下述方法的时候,仍然报错:java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher?
//接受参数
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
request.setCharacterEncoding("UTF-8");
//传输json格式对象
response.setContentType("application/json;charset=UTF-8");
String t_name=request.getParameter("name");
System.out.println(t_name);
//使用Map类型数据用于转换成json对象
Map<String,String> about_book=query(t_name);
System.out.println("函数调用后查询结果是否为空:"+about_book.isEmpty());
JSONObject jo=JSONObject.fromObject(about_book);
System.out.println("发送的json对象为:"+jo.toString());
这些语句写在exetute()方法中,实际上,当运行到JSONObject jo=JSONObject.fromObject(about_book);已停止继续执行,这一句在Myeclipse上并没有报错,但是在实际运行.jsp页面后,可以从响应中(欲使用json及ajax)看到错误消息如下:
但是所有依赖包均已导入了,请问这是什么原因造成的?
查找一下是否有Morpher这个类。或者clean再build重新编译下