將資料以json字串格式傳到前台請求頁面

2022-09-07 01:54:13 字數 576 閱讀 2865

1.前台ajax方法(這個是在flowdocaction的add.jsp頁面)

//序列號

var prefileno = factorycode+deptcode+"-"+modelseriescode+"-"+workprocesscode;

var yz=$.ajax(

},

error:function(data)

});2.後台頁面:因為此處是ssh的action,方法返回string型別預設去找對應頁面,而請求的頁面是另乙個action的result對應的頁面,所以此處的

(這裡是在flowdocversinoaction.j**a類裡)

//檔案編碼

public string getsort() throws exception else

}catch (numberformatexception ep) }}

max=max+1;//最大序號+1作為新增檔案的序號

if(max<10)else

}return null;

}catch(exception e)

}

json字串格式

res.write 前端轉化 fetch json config then response then data 發現前端報錯 uncaught in promise syntaxerror unexpected token in json at position 1 我乙個以為是fetch沒有配置...

json字串格式轉換

1.物件相互轉換 物件轉字串 user user newuser jsonobject object jsonobject.fromobject user string jsonstr object.tostring 字串轉物件 jsonobject jsonobj jsonobject.fromo...

C 將資料轉換為指定格式的json字串

實體類 class returnjson public int math private string name private int age private string address private listli new list public string name public int ...