Jscp - javascript client page

介绍了一种轻量级JavaScript库Jscp,该库基于Prototype构建,可在客户端浏览器中实现页面模板的数据渲染。通过将渲染工作从服务器侧移至浏览器侧,简化了服务器与客户端之间的交互,并易于实现如本地分页等功能。
In recent days i did some study on javascript and had some interesting thought.
I wrote a lightweight javascript library (built on prototype, I call it Jscp - javascript clientp page)
to implement this. With the library, the work of rendering page template with data
run on client-side, that is, in web browser programs. 
 
Traditional service model:
1. client   --- send request --->  server
2. client(wait)                            server (working for request, get result data)
3. client(wait)                            server (rendering page template with data)
4. client   <---  recv result page --- server
With jscp, the model becomes:
1. client   --- send request  ---> server
2. client   <---  recv page template --- server (could be cached for use many times)
3. client   --- send request --->  server
4. client(wait)                            server (working for request, get result data)
5. client   <---  recv result data --- server  (data use JSON format)
6. client (rendering page template with data)                 server
 
I think this model provide cleaner interface between server and client.
The code running on server focus on generate correct result data,
data be sent in standard JSON format, and the code to display it
run on client-side (though still be deployed on server).
I don't know if there is some existing js library has such feature,
i tried and didn't find.
 
For simple example comparision:
with PHP, in .php files you write:
... <? for i=0; i<3; ++i { ?>
... <? echo res[i].'/r/n' ?>
... <? } ?>
 
with Ruby on Rails, in .rhtml files you write:
... <% 1.to(3) do { |i| %>
... <%= @res[i] %>
... <% } %>
 
with Jscp, in .htm files your write: (use javascript)
... <%INC ../layout_header.htm %>
... <% var r=_RENDER_DATA; %>
... <% for i=0; i<3; ++i { %>
... <%= r.res[i] %>
... <% } %>
... <%INC ../layout_foot.htm %>

By moving the last rendering work from server-side to browser-side, some effects are easy to implemented, such as local pagination, local table sorting, etc. Jscp is not conflict with other Ajax technologies, since it is on the bottom layer of them.

I registered JSCP as a project on sourceforge.net,  it can be visited from the following URL:

http://jscapage.sourceforge.net

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值