用CppCMS实现web site并同时支持json_rpc服务

刘怀宇

1.将cppcms-0.99.10/examples/json_rpc/rpc.cpp文件中的json_service类拷贝到
examples/templates/hello-tmpl.cpp 中
2.修改hello-tmpl.cpp 中的main函数,添加两个服务



3.修改config.js 文件,添加 script_names : /jsonrpc , /html




4.在first.tmpl 中使用如下的html文本 替换掉原来的html




5.make
6. 执行生成的hello-tmpl     ./hello-tmpl -c config.js

7. 访问http://localhost:8080/html 在返回的html页面中计算除法,即可成功访问后台的json服务,得到结果

8.注意,IE6不支持JSON_RPC技术。


posted @ 2011-09-08 16:00  反正我信了  阅读(601)  评论(0编辑  收藏  举报