81,092
社区成员
发帖
与我相关
我的任务
分享
$(function() {
initLesson();
});
function initLesson(){
alert("aaa");
$ajax({
type:"POST",
url :"jiaowuchu/addTeacher?json",
success : function(data) {
alert(data.length);
}
});
@RequestMapping(value="/addTeacher",params="json",produces = "text/html;charset=UTF-8")
@ResponseBody
public String getLessonList() throws JsonGenerationException, JsonMappingException, IOException{
System.out.println("获取课程列表");
ObjectMapper mapper = new ObjectMapper();
List<Lesson> list=jiaowuchuService.LessonList();
List r=new ArrayList();
for(Lesson l:list){
r.add(l.getName());
}
String s=mapper.writeValueAsString(r);
return s;
}