java ajax 输出_正本清源:所谓Ajax输出的三种形式

本文探讨了如何通过在服务器端组装和验证对象来减少JavaScript代码,提高Ajax应用的可维护性。建议将数据保持在原始形式,如Map,服务器返回命令集合,由回调引擎执行具体操作,如更新字段、DOM操作等。强调Java的可控性优于JavaScript,提倡在可能的情况下优先使用Java处理任务。
摘要由CSDN通过智能技术生成

# re: 正本清源:所谓Ajax输出的三种形式  回复  更多评论

2005-12-30 23:19 by Vinson

Buffolo did a great job to provide an Ajax Engine, it is something like DWR, even though the implemenation is different.

In a real application, due to the maintainablity of the javascript, the less javascript, the better.

So it is better to assemble/validate the object in the serverside,while javascript only need to collect the data just into a map. and this can be generic.

Regarding the callback function, it can also be generic, the tasks that a callback function usualy like these.

. update field values.

. add/remove a dom node.

. update the html fragment.

. display errors/message.

.change stylecss.

. ...

you call it a callback engine. I think buffalo need to add this feature.

So there is no need to use JSON or xml, just keep the data in its original form, a Map of string, and then process them in the server side, it will make life

easier.

And the server side only need to return a collection of commands, the call back engine will know how to do it.

Java is more controllable than javascript. If anything can be done either in javascript, or in Java, Just do it with JAVA.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值