$.ajax(
{
type: "POST",
url: "/edit.html",
data: html,
dataType:'Text',
success: function(data) {
location.href = data;
}
}
);
@RequestMapping(value = "/edit.html", method = RequestMethod.POST)
@ResponseBody
public Object getPage(@RequestParam("title")String title, @RequestParam("data")String data, HttpSession httpSession, HttpServletResponse response) throws IOException, SQLException {
Announce announce = new Announce();
announce.setTitle(title);
announce.setAnnText(data);
announce.setTeaId((String) httpSession.getAttribute("id"));
Date date = new Date();
java.sql.Date sqldDate = new java.sql.Date(date.getTime());
announce.setAnnDate(sqldDate);
int id = editService.insertSelective(announce);
String bpid = "an-"+String.valueOf(id);
System.out.println(title+" "+data);
/* response.sendRedirect("showPage.html?id="+bpid);
PrintWriter printWriter = response.getWriter();
printWriter.print(bpid);
printWriter.flush();
printWriter.close();*/
Map map = new HashMap();
map.put("code",302);
map.put("url","showPage.html?id="+bpid);
return "showPage.html?id="+bpid;
//return new ModelAndView("redirect:showPage.html?id="+bpid);
}