Velocity 实例
[
2010/02/12 22:20 | by fubin ]
2010/02/12 22:20 | by fubin ]
Velocity是一个基于java的模板引擎(template engine)。它允许任何人仅仅简单的使用模板语言(template language)来引用由java代码定义的对象。 当Velocity应用于web开发时,界面设计人员可以和java程序开发人员同步开发一个遵循MVC架构的web站点,也就是说,页面设计人员可以只关注页面的显示效果,而由java程序开发人员关注业务逻辑编码。Velocity将java代码从web页面中分离出来,这样为web站点的长期维护提供了便利,同时也为我们在JSP和PHP之外又提供了一种可选的方案。 Velocity的能力远不止web站点开发这个领域,例如,它可以从模板(template)产生SQL和PostScript、XML,它也可以被当作一个独立工具来产生源代码和报告,或者作为其他系统的集成组件使用。Velocity也可以为Turbine web开发架构提供模板服务(template service)。
EXT Tree Grid
[
2010/02/10 11:07 | by fubin ]
2010/02/10 11:07 | by fubin ]
在Ext Grid加上按钮
[
2010/01/19 16:28 | by fubin ]
2010/01/19 16:28 | by fubin ]
var FileList_cm = new Ext.grid.ColumnModel([{header: '附件名称',dataIndex: 'id'}, {header: '附件类型',dataIndex: 'sex'}, {header: '附件大小',dataIndex: 'name'},
{header: '上传人',dataIndex: 'descn'},{header: '上传时间',dataIndex: 'a1'},{header: '下载',dataIndex: 'a2',renderer:renderDescn}]);
//排序选项
FileList_cm.defaultSortable = true;
//
var FileList_data = [['送修报告', '原始文件', '1M', '符彬', '2009-10-10', ''], ['本次送修依据', '原始文件', '1M', '符彬', '2009-10-10', ''], ['厂家送修反馈', '完工反馈', '2M','符彬', '2009-10-10', '']];
var FileList_ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(FileList_data),
reader: new Ext.data.ArrayReader({}, [{name: 'id',mapping: 0}, {name: 'sex',mapping: 1},
{name: 'name',mapping: 2}, {name: 'descn',mapping: 3}, {name: 'a1',mapping: 4}, {name: 'a2',mapping: 5}])
});
FileList_ds.load();
var FileList = new Ext.grid.GridPanel({
ds: FileList_ds,
cm: FileList_cm,
autoHeight: true,
//列自动适应
viewConfig:{
forceFit: true
}
//翻页菜单
/*
,bbar: new Ext.PagingToolbar({
pageSize: 10,
store: FileList_ds,
displayInfo: true,
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: "没有记录"
})*/
});
function renderDescn(value, cellmeta, record, rowIndex, columnIndex, store) {
var str = "<input type='button' value='点击下载' onclick='alert(\"" +
"这个单元格的值是:" + value + "\\n" +
"这个单元格的配置是:{cellId:" + cellmeta.cellId + ",id:" + cellmeta.id + ",css:" + cellmeta.css + "}\\n" +
"这个单元格对应行的record是:" + record.data["id"] + ",一行的数据都在里边\\n" +
"这是第" + rowIndex + "行\\n" +
"这是第" + columnIndex + "列\\n" +
"这个表格对应的Ext.data.Store在这里:" + store + ",随便用吧。" +
"\")'>";
return str;
}
{header: '上传人',dataIndex: 'descn'},{header: '上传时间',dataIndex: 'a1'},{header: '下载',dataIndex: 'a2',renderer:renderDescn}]);
//排序选项
FileList_cm.defaultSortable = true;
//
var FileList_data = [['送修报告', '原始文件', '1M', '符彬', '2009-10-10', ''], ['本次送修依据', '原始文件', '1M', '符彬', '2009-10-10', ''], ['厂家送修反馈', '完工反馈', '2M','符彬', '2009-10-10', '']];
var FileList_ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(FileList_data),
reader: new Ext.data.ArrayReader({}, [{name: 'id',mapping: 0}, {name: 'sex',mapping: 1},
{name: 'name',mapping: 2}, {name: 'descn',mapping: 3}, {name: 'a1',mapping: 4}, {name: 'a2',mapping: 5}])
});
FileList_ds.load();
var FileList = new Ext.grid.GridPanel({
ds: FileList_ds,
cm: FileList_cm,
autoHeight: true,
//列自动适应
viewConfig:{
forceFit: true
}
//翻页菜单
/*
,bbar: new Ext.PagingToolbar({
pageSize: 10,
store: FileList_ds,
displayInfo: true,
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: "没有记录"
})*/
});
function renderDescn(value, cellmeta, record, rowIndex, columnIndex, store) {
var str = "<input type='button' value='点击下载' onclick='alert(\"" +
"这个单元格的值是:" + value + "\\n" +
"这个单元格的配置是:{cellId:" + cellmeta.cellId + ",id:" + cellmeta.id + ",css:" + cellmeta.css + "}\\n" +
"这个单元格对应行的record是:" + record.data["id"] + ",一行的数据都在里边\\n" +
"这是第" + rowIndex + "行\\n" +
"这是第" + columnIndex + "列\\n" +
"这个表格对应的Ext.data.Store在这里:" + store + ",随便用吧。" +
"\")'>";
return str;
}

Like home? The four planets in the Gliese system, orbiting a star dimmer than our sun some 20 light-years away, include the newly found Gliese 581 e (foreground)—a rocky place just twice Earth's mass—and 581 d, which could harbor liquid water.
看起来是不是很象地球?这是红矮星格雷司星系上的一个行星,一个和我们太阳大约一样的恒星,距离我们20光年。包括最近发现的581 e,这个两倍于地球的行星很可能有支持生命的液体。
看起来很像电影里阿凡达的家园对吗?
JSP显示XML数据结构
[
2010/01/13 09:24 | by fubin ]
2010/01/13 09:24 | by fubin ]
真是忙碌啊,基本忘乎自己了!
[
2010/01/10 08:51 | by fubin ]
2010/01/10 08:51 | by fubin ]
已经好几周没有写日志啦。在工作和生活之间如何找到平衡点呢?有没有平衡点呢?




下载文件


