惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CERT Recently Published Vulnerability Notes
S
Security @ Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Help Net Security
Help Net Security
Spread Privacy
Spread Privacy
WordPress大学
WordPress大学
S
Schneier on Security
博客园 - 聂微东
C
Cybersecurity and Infrastructure Security Agency CISA
F
Full Disclosure
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
D
Docker
aimingoo的专栏
aimingoo的专栏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
小众软件
小众软件
A
About on SuperTechFans
Scott Helme
Scott Helme
Cloudbric
Cloudbric
T
Threatpost
雷峰网
雷峰网
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Microsoft Azure Blog
Microsoft Azure Blog
T
Tailwind CSS Blog
T
Tor Project blog
T
The Blog of Author Tim Ferriss
The Hacker News
The Hacker News
C
Cyber Attacks, Cyber Crime and Cyber Security
量子位
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
Intezer
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy International News Feed
TaoSecurity Blog
TaoSecurity Blog
N
News and Events Feed by Topic
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
P
Privacy & Cybersecurity Law Blog

博客园 - 天天无用

jsonp原理实例及mvc中的应用 ubuntu笔记 修复MVC3中使用Remote验证的一点小问题 诺基亚手机S60系统证书申请、软件签名图文教程 JAXER留言板-一个html页面的ajax留言版 - 天天无用 - 博客园 Jquery插件研究:Ajax File Upload 本月wii游戏太多,感觉有点堕落 使用jQuery加DIV实现可以动态添加的金字塔结构 自制的操作下拉列表框(SELECT)的三个jquery插件(ajax填充、联动、增加选项) - 天天无用 - 博客园 Asp.net 2.0 TreeView控件使用jQuery无刷新添加节点详细说明 用jQuery实现.net 2.0 treeview客户端无刷新操作的实例 基于jQuery的AJAX和JSON实现纯html数据模板 自己写的DataTable转换成JSON字符串的函数 自己写的jQuery自动完成的插件(AutoComplete) asp.net treeview控件无刷新选择和删除节点(使用jquery) - 天天无用 - 博客园 纵向合并gridview单元格的两种方法 .net下两种json序列化速度比对 asp.net 2.0 中 TreeView控件中的checkbox客户端操作 asp.net 2.0中根据roles显示不同的sitemap - 天天无用 - 博客园
初探JAXER
天天无用 · 2008-01-25 · via 博客园 - 天天无用

    昨天更新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做了一个简单的例子。

全部代码如下:

 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2<html>
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf8"/>
 5        <title>Untitled Document</title>
 6        <script language=javascript src=jquery.js>
 7        
</script>
 8        <script runat=server-proxy>
 9            function getTable(rows){
10                var a = new Array();
11                a[0= rows;
12                var conn = new Jaxer.DB.SQLite.Connection({
13                    PATH: "E:\\test\\sqlite\\world.db3"
14                }
);
15                var rs = conn.execute("Select * from [City] where id <= ?", a);
16                return (rs.toHTML());
17            }

18        
</script>
19        <script language=JavaScript>
20            $(function(){
21                $("#button1").click(function(){
22                    $("#div1").append(getTable(1000));
23                }
);
24                $("#button2").click(function(){
25                    getTableAsync(setdata, 1000)
26                }
);
27                $("#button3").click(function(){
28                    $("#div1").html("");
29                }
);
30            }
);
31            function setdata(table){
32                $("#div1").html(table);
33            }

34            
35        
</script>
36    </head>
37    <body>
38        <input type=button id=button1 value=同步方法><input type=button id=button2 value=异步方法><input type=button id=button3 value=清除>
39        <div id=div1>
40        </div>
41    </body>
42</html>
43


运行截图:

    详细的就不说了,关键是<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就可以看到效果。