Jscp - javascript client page

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

  • 0
    点赞
  • 0
    收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论

打赏作者

xuting

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值