Extjs如何與資料庫互動(四)

2021-05-04 09:01:43 字數 570 閱讀 9360

本篇為extjs連線資料庫, 通過xml來實現, 所以當查詢完資料庫後應該是以xml顯示的,

然後通過xmlreader來讀取。 資料庫連線內容省略一下。

jsp頁面:

、、 response.setcharacterencoding("utf-8");  //設定編碼

response.setcontenttype("text/xml");

printwriter pw = response.getwriter();

string str = "<?xml version=/"1.0/" encoding=/"utf-8/"?>/n"; //輸出格式為xml

string name = "";

string id = "";

string address = "";

//此處為資料庫連線

str +="/n";   

while(rs.next())

str +="/n";   

pw.write(str);

pw.close();

關於其他的操作,比如說增刪改在以後將會提到。

Extjs如何與資料庫互動(一)

一般需要新增一組資料,引入乙個概念ext.data.reader,這裡的reader功能非常單一,只是用來 解析資料的到,extjs支援不同的資料格式,也就需要不同的資料解析器。而這個reader就是承擔解析器的作用。1 陣列形式資料解析 特殊的json形式資料,因此,arrayreader是jso...

資料庫互動

什麼是資料庫的互動?第一得確定與資料庫連線起來 public dbhelper context context,string name,sqlitedatabase.curso ctory factory,int version override public void oncreate sqlit...

資料庫與python的互動

try from mysql import con connect host localhost port 3306,database df user root password mysql charset utf 8 2 連線物件 獲得cursor物件 cs1 con.cursor 執行inser...