public void write(String content, String charset) { getHttpResponse().setCharacterEncoding(charset); getHttpResponse().setContentType("text/html;charset=" + charset); try { getHttpResponse().getWriter().print(content); } catch (IOException e) { e.printStackTrace(); } }
public String syncRes(){ if (**) { write("操作成功", "UTF-8"); } catch (IOException e) { e.printStackTrace(); write("操作失败:"+e.getMessage(), "UTF-8"); }else { write("操作失败:没有传递正确的参数", "UTF-8"); } return null; }
function syncRes(){ if($("#indextemplet").val()==""){ alert("请选择页面模板"); selectTemplet($("#siteId").val()); return false; } if(confirm("此操作将把模板资源文件复制并覆盖到此站点,确认此操作么?")){ $.post("site_syncRes.do","site.id="+$("#siteId").val()+"&site.indextemplet="+$("#indextemplet").val(),syncResComplete,"text"); }}function syncResComplete(data){ alert(data);}