天天无用

要用最简单的方法解决最实际的问题

用户操作
[即时聊天] [发私信] [加为好友]
天天无用ID:luq885
42635次访问,排名2643好友5人,关注者24
太懒
luq885的文章
原创 18 篇
翻译 0 篇
转载 8 篇
评论 38 篇
天天无用的公告

本博客所有原创文章版权归本人所有,如欲转载或用于商业请先联系本人。

最近评论
SNNPSNNP:wow gold

When you play a game of the day, the list of friends in the game whether there are always a few names of black
wow power leveling<……
agang:发一份给我吧:xiaoxu04@sina.com
谢谢!
eleph:我的是VS2003 该怎么办呀,刚试了一下,你的代码.在我这上面好像不行样.
xqxujun:好像不通用啊,,
鱼鱼:能不能加上自动选择搜索出来的第一个为默认值?
文章分类
收藏
相册
链接
『 天道酬勤 』(RSS)
Dflying Chen(RSS)
听棠.NET(RSS)
存档
软件项目交易
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes

原创 初探JAXER收藏

新一篇: JAXER留言板-一个html页面的ajax留言版 | 旧一篇: Jquery插件研究:Ajax File Upload

    昨天更新Aptana的时候发现Aptana网站上多了一个JAXER,不知为何物。google了一把也只找到一个介绍的翻译,再回网站上看了一下,原来是22日刚发布的。不过看过简单介绍后,觉得最吸引人的地方就是这几张图



     直接运行htm页面,服务器端运行的javascript,服务器端和浏览器端都能运行的方法,还有可以从浏览器端调用的服务器端的方法,有点意思,感觉有点像asp.net。马上研究了一下它的API文档(http://aptana.com/reference/jaxer/api/Jaxer.index-frame.html),基本的东西都全了,数据库支持mySql和SQLite。
    SQLite使用太方便了,找了一个SQLiteSpy带的world.db3数据库,使用最新的Aptana(已经包括了JAXER插件和服务器),结合jquery做了一个简单的例子。

全部代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    
<head>
        
<meta http-equiv="Content-Type" content="text/html; charset=utf8"/>
        
<title>Untitled Document</title>
        
<script language=javascript src=lib/jquery/jquery.js>
        
</script>
        
<script runat=server-proxy>
            
function getTable(rows){
                
var a = new Array();
                a[
0= rows;
                
var conn = new Jaxer.DB.SQLite.Connection({
                    PATH: 
"E:\test\sqlite\world.db3"
                }
);
                
var rs = conn.execute("Select * from [City] where id <= ?", a);
                
return (rs.toHTML());
            }

        
</script>
        
<script language=JavaScript>
            $(
function(){
                $(
"#button1").click(function(){
                    $(
"#div1").append(getTable(1000));
                }
);
                $(
"#button2").click(function(){
                    getTableAsync(setdata, 
1000)
                }
);
                $(
"#button3").click(function(){
                    $(
"#div1").html("");
                }
);
            }
);
            
function setdata(table){
                $(
"#div1").html(table);
            }

            
        
</script>
    
</head>
    
<body>
        
<input type=button id=button1 value=同步方法><input type=button id=button2 value=异步方法><input type=button id=button3 value=清除>
        
<div id=div1>
        
</div>
    
</body>
</html>

运行截图:

    详细的就不说了,关键是<script runat=server-proxy>...</script>这部分,在客户端生成了这么两个方法:
function getTable() {return Jaxer.remote("getTable", arguments);}
function getTableAsync(callback) {return Jaxer.remote("getTable", arguments, callback);}

    这样在浏览器端的js就可以直接使用了。
    虽然还有很多问题,最讨厌的就是生成的页面上有全部的clientFramework的源代码,虽然是压缩的,但看着还是很麻烦,估计以后的版本这个是首先要修改的。

    上面的例子可以到这里http://download.csdn.net/user/luq885/直接下载,就是页面和一个jquery.js。

    再说一下用JAXER服务器运行的方法,到http://aptana.com/jaxer/download这里下载一个JAXER的服务器端,附带着Apache服务器,直接解压后运行StartServers.bat
就可以启动,把上面那个页面和jquery.js放到public文件夹下,访问http://127.0.0.1:8081/test2.html就可以看到效果。
   




发表于 @ 2008年01月25日 01:00:00|评论(loading...)|编辑

新一篇: JAXER留言板-一个html页面的ajax留言版 | 旧一篇: Jquery插件研究:Ajax File Upload

评论

#xqxujun 发表于2008-07-11 15:36:29  IP: 60.191.34.*
好像不通用啊,,
#SNNPSNNP 发表于2008-09-24 14:37:26  IP: 221.221.178.*
wow gold

When you play a game of the day, the list of friends in the game whether there are always a few names of blackwow power leveling wow power leveling friends, who have accompanied you to upgrade, to accompawow power leveling wow power levelingny you in Aizelasi travel together, shoulder toshoulder once together Fighting against the forces of evil, has wow power levelingwow power levelinga mysterious caves to explore the unknown, had fallen at BoSS experience with the excitement and fun equipment. Whether the game or reality, the road of life there are countless friends Friends accompanied, however, perhaps because these wow goldWorld of Warcraft goldare the reasons, they temporarily left the game, leaving you alone miss.
Peace in the always easy, perhaps you miss the same wow power levelingwow power levelingtime thought, maybe these friends have more happiness. But now, when people across the He
发表评论  


登录
Csdn Blog version 3.1a
Copyright © 天天无用