使用dhmlxgrid+struts+dao快速实现功能(界面如图)

A


(1)主页界面:index.jsp
配置dhtmlxgrid实现界面数据控制. 例如:输入的数据类型,是否居中,是否查找字段,长宽等等.
var data = {
		'id':{header:'ID',width:60,type:'ro',align:'center', notnull:0},
		'e_name':{header:'英文名',width:120,type:'ed',align:'left',notnull:1,filter:1},
		'parent_id':{header:'父类ID',width:60,type:'num',align:'left',notnull:1,filter:1},
		'sort_id',:{header:'排序',width:50,type:'ed',align:'center'cnotnull:0},
		'create_time':{header:'创建时间',width:70,type:'ro',align:'left',notnull:0}
	};

	mygrid.setInitAll(data);
	mygrid.enablePaging(true);
	mygrid.init();
	mygrid.loadXML("/tbss/class/query.do",true,"");


2.query.do返回xml结果

 <?xml version="1.0" encoding="GBK" ?> 
- <rows rowsnum="4">
 
<header>
   <column>id</column>
   <column>e_name</column>
   <column>parent_id</column>
   <column>sort_id</column>
   <column>create_time</column>
</header>

- <row id="1">
  <cell>1</cell> 
  <cell>edeee2333</cell> 
  <cell>-1</cell> 
  <cell>33</cell> 
  <cell>2007-08-16 12:33:41.0</cell> 
  </row>
- <row id="2">
  <cell>2</cell> 
  <cell>Pans</cell> 
  <cell>1</cell> 
  <cell>1</cell> 
  <cell>2007-08-16 12:41:26.0</cell> 
  </row>
- <row id="3">
  <cell>3</cell> 
  <cell>ssss</cell> 
  <cell>2</cell> 
  <cell>2</cell> 
  <cell>2007-08-16 12:41:44.0</cell> 
  </row>
- <row id="4">
  <cell>4</cell> 
  <cell>ddd</cell> 
  <cell>2</cell> 
  <cell>1</cell> 
  <cell>2007-08-16 01:32:42.0</cell> 
  </row>
  </rows>


(3)将url修改的字段数据自动转为List<ProductClass>
通过状态实现更新,删除,添加操作.

你可能感兴趣的:(DAO,xml,jsp,struts)