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 ("Operation succeeded", "UTF-8"),} catch (IOException e) {e.printstacktrace (); Write ("Operation failed:" +e.getmessage (), "UTF-8");} else {Write ("operation failed: Correct parameter not passed", "UTF-8");} return null;}
function Syncres () {if ($ ("#indextemplet"). val () = = "") {alert ("Please select Page template"), Selecttemplet ($ ("#siteId"). Val ()); return false;} if (Confirm ("This operation will copy the template resource file and overwrite it to this site, confirm this action?")) { $.post ("Site_syncres.do", "site.id=" +$ ("#siteId"). Val () + "&site.indextemplet=" +$ ("#indextemplet"). Val ( ), Syncrescomplete, "text");}} function Syncrescomplete (data) {alert (data);}
$.post () Request ation request, JSP gets the processing result