到AJAX調用的響應,我從我的JSP中的Ajax調用的servlet。當我想返回字符串,那麼它工作正常。但我想發送響應作爲一個字符串數組,然後它不工作。有可能我可以從servlet發送字符串數組作爲ajax響應。如何發送字符串數組從servlet的
String[] roleAccess=null;
response.setContentType("text/html");
try{
roleAccess=new String[23];
roleAccess[0]="";
roleAccess[1]="checked";
roleAccess[2]="";
response.getWriter().write(roleAccess.toString());---this part I need to change.
以json格式發送ajax響應。 http://www.json.org/ –